Open Lemonymous opened 1 year ago
Does this have something to do with it? https://github.com/godotengine/godot/blob/61d2c855114c824f5ca27ded0a1fa71cc7b21134/servers/physics_2d/godot_body_2d.cpp#L70
Should it not check if the body has a custom center of mass?
Possibly related to issue #55148
This can be troublesome, my game features a destructible terrain, and when a new polygon is divided, the function Geometry2D.clip_polygons()
returns a polygon with a high offset, this can be workaround with transform2d or something, but still isnt ideal
Godot version
v4.0.stable.mono.official [92bee43ad]
System information
Windows 10, Forward+, NVIDIA GeForce GTX 1050 Ti (31.0.15.1694)
Issue description
When a
RigidBody2D
hascenter_of_mass_mode = RigidBody2D.CENTER_OF_MASS_MODE_CUSTOM
, and a customcenter_of_mass
as well asinertia
set to 0; the rigid body's auto computed inertia can be incorrect.A video of the attached mrp - Both boxes have the same size polygon, and inertia set to 0. So their inertia should be calculated to the same amount. However, the right box rotates slower.
https://user-images.githubusercontent.com/10490534/222751892-74e9f5da-ce99-4f81-8e8b-247e71447bcd.mp4
Steps to reproduce
1.0 / PhysicsServer2D.body_get_direct_state(body.get_rid()).inverse_inertia)
Minimal reproduction project
This project shows two boxes with the same size polygon side by side. The left box's polygon is constructed around 0,0 The right box's polygon is constructed around 150,150
test center of mass.zip