The Godot Community Forums are back up and running! Please read the the announcement post for important information on what happened. Thanks!

Specifying inertia for RigidBodies

UnknownUserUnknownUser Posts: 0

I am making a spacecraft simulator where you can build a ship out of modules. Since I know the mass of the modules and I know the location of the center of mass of each module relative to the center of mass of the rigid body, I can calculate the moment of inertia about each of the axes using parallel axis theorem. Since I can't directly set the inverse inertia, I have to find a collider shape that approximates it. Ideally I would find a shape that I can control the inertia about the three axes by specifying the extents along the three axes. A box collider seems to fit the bill and I was able to determine the formula Godot uses for the Moment of Inertia, e.g. Ix = 1/12M*(y^2 + z^2) and similar for Iy and Iz. But in order to determine the extents of the box needed to match the moment of inertia, I would need to solve a system of 3 non-linear equations. Is there an easier way to specify moments of inertia for rigidbodies?


  • TwistedTwiglegTwistedTwigleg Posts: 3,129Admin

    Welcome to the forums @ericwood73!

    It doesn't look like there is a way to set inertia directly in Godot, not with the current API. It appears that some people have worked around it though. I'd recommend making a proposal on the Godot Proposal's repository, if one is not already opened for this (I didn't see any).

  • Thanks for the link. It looks like the workaround is to compute angular velocity ourselves using know moments of inertia about the body axes. The you can use central force to apply all forces through CoM to avoid rotation. Although I've noticed you can also prevent rotation by not having a collider, because that makes inverse inertia 0 which makes inertia infinite.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file