79573287

Date: 2025-04-14 13:51:45
Score: 0.5
Natty:
Report link

The post you found already answers your question:

You have to offset/shift the graphics and collision shapes, instead of the rigid body: there is no center of mass offset or shift in a rigid body. The setCenterOfMassTransform sets the world transform for a rigid body, which is always equal to the center of mass of the rigid body in world space. So instead of shifting the rigid body, you need to shift the graphics and collision shapes.

A Shape itself cannot have an offset center of mass: it's center of mass is the center.

Even if you were to use a btCompoundShape comprised of multiple shapes, it would still have center of mass in the center.

What you will most likely need to do (to make a rigid body with off-center mass, such as a hammer) is to use two RigidBodies and then use a constraint (like btFixedConstraint, btHingeConstraint, etc) to join them.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: 1owk3y