diff options
| author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-06-10 17:37:19 -0700 |
|---|---|---|
| committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-09-06 10:20:16 -0700 |
| commit | 82ea2a7045e336bf4ce17358e2057558f89c3ac0 (patch) | |
| tree | 3a1d5096b27926ffb19169f96558e75ee448ed85 /servers/physics_3d/physics_server_3d_sw.cpp | |
| parent | e1ae2708ee52f8a0b361ecffd8567f304fad7f76 (diff) | |
| download | redot-engine-82ea2a7045e336bf4ce17358e2057558f89c3ac0.tar.gz | |
Proper support for custom mass properties in 2D/3D physics bodies
Changes:
-Added support for custom inertia and center of mass in 3D
-Added support for custom center of mass in 2D
-Calculated center of mass from shapes in 2D (same as in 3D)
-Fixed mass properties calculation with disabled shapes in 2D/3D
-Removed first_integration which is not used in 2D and doesn't seem to
make a lot of sense (prevents omit_force_integration to work during the
first frame)
-Support for custom inertia on different axes for RigidBody3D
Diffstat (limited to 'servers/physics_3d/physics_server_3d_sw.cpp')
| -rw-r--r-- | servers/physics_3d/physics_server_3d_sw.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/servers/physics_3d/physics_server_3d_sw.cpp b/servers/physics_3d/physics_server_3d_sw.cpp index a214e80c6c..8de54c5c48 100644 --- a/servers/physics_3d/physics_server_3d_sw.cpp +++ b/servers/physics_3d/physics_server_3d_sw.cpp @@ -643,20 +643,27 @@ uint32_t PhysicsServer3DSW::body_get_user_flags(RID p_body) const { return 0; }; -void PhysicsServer3DSW::body_set_param(RID p_body, BodyParameter p_param, real_t p_value) { +void PhysicsServer3DSW::body_set_param(RID p_body, BodyParameter p_param, const Variant &p_value) { Body3DSW *body = body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_param(p_param, p_value); }; -real_t PhysicsServer3DSW::body_get_param(RID p_body, BodyParameter p_param) const { +Variant PhysicsServer3DSW::body_get_param(RID p_body, BodyParameter p_param) const { Body3DSW *body = body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0); return body->get_param(p_param); }; +void PhysicsServer3DSW::body_reset_mass_properties(RID p_body) { + Body3DSW *body = body_owner.getornull(p_body); + ERR_FAIL_COND(!body); + + return body->reset_mass_properties(); +} + void PhysicsServer3DSW::body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) { Body3DSW *body = body_owner.getornull(p_body); ERR_FAIL_COND(!body); |
