summaryrefslogtreecommitdiff
path: root/servers/physics_server_2d.h
diff options
context:
space:
mode:
authorCamille Mohr-Daurat <pouleyKetchoup@gmail.com>2021-09-06 11:31:15 -0700
committerGitHub <noreply@github.com>2021-09-06 11:31:15 -0700
commitb277c8828089156682abe09b4d0d8077b7298bd2 (patch)
tree3a1d5096b27926ffb19169f96558e75ee448ed85 /servers/physics_server_2d.h
parente1ae2708ee52f8a0b361ecffd8567f304fad7f76 (diff)
parent82ea2a7045e336bf4ce17358e2057558f89c3ac0 (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_server_2d.h')
-rw-r--r--servers/physics_server_2d.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h
index 20cf4cb31b..1145bb8b91 100644
--- a/servers/physics_server_2d.h
+++ b/servers/physics_server_2d.h
@@ -48,6 +48,7 @@ public:
virtual real_t get_total_linear_damp() const = 0; // get density of this body space/area
virtual real_t get_total_angular_damp() const = 0; // get density of this body space/area
+ virtual Vector2 get_center_of_mass() const = 0;
virtual real_t get_inverse_mass() const = 0; // get the mass
virtual real_t get_inverse_inertia() const = 0; // get density of this body space
@@ -402,15 +403,18 @@ public:
BODY_PARAM_BOUNCE,
BODY_PARAM_FRICTION,
BODY_PARAM_MASS, ///< unused for static, always infinite
- BODY_PARAM_INERTIA, // read-only: computed from mass & shapes
+ BODY_PARAM_INERTIA,
+ BODY_PARAM_CENTER_OF_MASS,
BODY_PARAM_GRAVITY_SCALE,
BODY_PARAM_LINEAR_DAMP,
BODY_PARAM_ANGULAR_DAMP,
BODY_PARAM_MAX,
};
- virtual void body_set_param(RID p_body, BodyParameter p_param, real_t p_value) = 0;
- virtual real_t body_get_param(RID p_body, BodyParameter p_param) const = 0;
+ virtual void body_set_param(RID p_body, BodyParameter p_param, const Variant &p_value) = 0;
+ virtual Variant body_get_param(RID p_body, BodyParameter p_param) const = 0;
+
+ virtual void body_reset_mass_properties(RID p_body) = 0;
//state
enum BodyState {