Page 1 of 1

Adjust center of gravity?

Posted: Sun Sep 25, 2011 3:05 am
by preen
When a dynamic body is made, the CoG seems to be set as the center of volume of the shape. The CoG is then the same as the object's position, and the points in the object's shape are in relation to that position.

Is it possible to adjust the CoG after creating a body?

Say, if you wanted to simulate a body with a drasticly odd distribution of mass. Like an hourglass, with all the sand in one side, or a race car, with it's mass close to the floor.

If not, is it possible to use a compound body to get that result? (each half of the hourglass would be it's own entry with it's own mass. When combined, the CoG would be closer to the full side)

Re: Adjust center of gravity?

Posted: Sun Sep 25, 2011 3:09 am
by Norbo
Is it possible to adjust the CoG after creating a body?
Yup, by offsetting the collision shape:

Code: Select all

entity.CollisionInformation.LocalPosition = new Vector3(0,1,0);

Re: Adjust center of gravity?

Posted: Sun Sep 25, 2011 3:18 am
by Norbo
is it possible to use a compound body to get that result? (each half of the hourglass would be it's own entry with it's own mass. When combined, the CoG would be closer to the full side)
That approach would also work.

Re: Adjust center of gravity?

Posted: Sun Sep 25, 2011 3:29 am
by preen
That does the trick, thanks Norbo.