diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-10-19 16:16:00 -0700 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-10-19 16:22:30 -0700 |
commit | c1577e5a3f97b15fa464b0b94b9172b20835c33a (patch) | |
tree | 56e08acfeb4e07d3d69dfd39bb73c5efb13eca5d /servers/physics_2d/godot_body_2d.h | |
parent | a4fbb67902f493bff503dafd0ccc6277af85f3a1 (diff) | |
download | redot-engine-c1577e5a3f97b15fa464b0b94b9172b20835c33a.tar.gz |
Fix 2D center of mass not updated from transform
Same logic as what was done in 3D, applied to 2D center of mass.
Also did some minor cleanup in 3D and fixed center of mass transform
during the first frame after teleporting a dynamic body.
Diffstat (limited to 'servers/physics_2d/godot_body_2d.h')
-rw-r--r-- | servers/physics_2d/godot_body_2d.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/servers/physics_2d/godot_body_2d.h b/servers/physics_2d/godot_body_2d.h index c4f3578f1b..5fce362fa7 100644 --- a/servers/physics_2d/godot_body_2d.h +++ b/servers/physics_2d/godot_body_2d.h @@ -66,6 +66,7 @@ class GodotBody2D : public GodotCollisionObject2D { real_t inertia = 0.0; real_t _inv_inertia = 0.0; + Vector2 center_of_mass_local; Vector2 center_of_mass; bool calculate_inertia = true; @@ -139,7 +140,9 @@ class GodotBody2D : public GodotCollisionObject2D { uint64_t island_step = 0; - _FORCE_INLINE_ void _compute_area_gravity_and_damping(const GodotArea2D *p_area); + void _compute_area_gravity_and_damping(const GodotArea2D *p_area); + + void _update_transform_dependent(); friend class GodotPhysicsDirectBodyState2D; // i give up, too many functions to expose |