diff options
author | Camille Mohr-Daurat <pouleyKetchoup@gmail.com> | 2021-09-06 11:31:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-06 11:31:15 -0700 |
commit | b277c8828089156682abe09b4d0d8077b7298bd2 (patch) | |
tree | 3a1d5096b27926ffb19169f96558e75ee448ed85 /servers/physics_2d/physics_server_2d_sw.cpp | |
parent | e1ae2708ee52f8a0b361ecffd8567f304fad7f76 (diff) | |
parent | 82ea2a7045e336bf4ce17358e2057558f89c3ac0 (diff) |
Merge pull request #49610 from nekomatata/center-of-mass-calculation
Proper support for custom mass properties in 2D/3D physics bodies
Diffstat (limited to 'servers/physics_2d/physics_server_2d_sw.cpp')
-rw-r--r-- | servers/physics_2d/physics_server_2d_sw.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/servers/physics_2d/physics_server_2d_sw.cpp b/servers/physics_2d/physics_server_2d_sw.cpp index 85b5e40752..d0a42ca95b 100644 --- a/servers/physics_2d/physics_server_2d_sw.cpp +++ b/servers/physics_2d/physics_server_2d_sw.cpp @@ -743,20 +743,27 @@ uint32_t PhysicsServer2DSW::body_get_collision_mask(RID p_body) const { return body->get_collision_mask(); }; -void PhysicsServer2DSW::body_set_param(RID p_body, BodyParameter p_param, real_t p_value) { +void PhysicsServer2DSW::body_set_param(RID p_body, BodyParameter p_param, const Variant &p_value) { Body2DSW *body = body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_param(p_param, p_value); }; -real_t PhysicsServer2DSW::body_get_param(RID p_body, BodyParameter p_param) const { +Variant PhysicsServer2DSW::body_get_param(RID p_body, BodyParameter p_param) const { Body2DSW *body = body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0); return body->get_param(p_param); }; +void PhysicsServer2DSW::body_reset_mass_properties(RID p_body) { + Body2DSW *body = body_owner.getornull(p_body); + ERR_FAIL_COND(!body); + + return body->reset_mass_properties(); +} + void PhysicsServer2DSW::body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) { Body2DSW *body = body_owner.getornull(p_body); ERR_FAIL_COND(!body); |