mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Expose local center of mass in physics servers
Center of mass in body's local space is more useful than the transformed one in some cases, like drawing its position for debug. It's especially useful to get the generated local center of mass when in auto mode (by default). Physics Server BODY_PARAM_CENTER_OF_MASS: Now always returns the local center of mass, instead of setting a local center of mass and getting a transformed one. This causes compatibility breaking, but it makes more sense for the parameter to be consistent between getter and setter. Direct Body State: There are now two properties, because both of them can be useful in different situations. center_of_mass: relative position in global coordinates (same as before) center_of_mass_local: position in local coordinates
This commit is contained in:
parent
25bea73544
commit
fc8c766ef9
16 changed files with 30 additions and 6 deletions
|
|
@ -282,6 +282,7 @@ public:
|
|||
void reset_mass_properties();
|
||||
|
||||
_FORCE_INLINE_ const Vector2 &get_center_of_mass() const { return center_of_mass; }
|
||||
_FORCE_INLINE_ const Vector2 &get_center_of_mass_local() const { return center_of_mass_local; }
|
||||
_FORCE_INLINE_ real_t get_inv_mass() const { return _inv_mass; }
|
||||
_FORCE_INLINE_ real_t get_inv_inertia() const { return _inv_inertia; }
|
||||
_FORCE_INLINE_ real_t get_friction() const { return friction; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue