Body.mass - odd behaviour

Topics: Developer Forum
Oct 26, 2007 at 3:06 PM

I am not sure if this is a bug, or a misunderstanding on my part.

I found that if I set the body.mass after constructing it, it doesnt set the momentOfInertia.

It is set if I use the factoryMethod.

Should I be managing the MoI myself?

Cheers muchly


ps... I now have the physics engine working nicely with replays in my game, next up is predicting future locations.

Oct 26, 2007 at 4:27 PM
If you are not using the factory, they yes you need to supply the MOI.

Just look at the code in the BodyFactory to see how you should do it:

Body body = new Body();
body.Mass = mass;
body.MomentOfInertia = mass * (width * width + height * height) / 12;
return body;