This commit is contained in:
MihailRis
2025-08-09 22:43:06 +03:00
parent 61da6b44a1
commit 5583734bc2
10 changed files with 331 additions and 307 deletions
+9
View File
@@ -26,6 +26,15 @@ dv::value Rigidbody::serialize(bool saveVelocity, bool saveBodySettings) const {
return bodymap;
}
void Rigidbody::deserialize(const dv::value& root) {
dv::get_vec(root, "vel", hitbox.velocity);
std::string bodyTypeName;
root.at("type").get(bodyTypeName);
BodyTypeMeta.getItem(bodyTypeName, hitbox.type);
root["crouch"].asBoolean(hitbox.crouching);
root["damping"].asNumber(hitbox.linearDamping);
}
template <void (*callback)(const Entity&, size_t, entityid_t)>
static sensorcallback create_sensor_callback(Entities& entities) {
return [&entities](auto entityid, auto index, auto otherid) {