This project has moved and is read-only. For the latest updates, please go here.

Changing Mass Dynamically

Topics: Developer Forum, User Forum
Aug 22, 2009 at 1:14 PM

I have been working with Farsser and notice that the MOI is not recalculated when I change the mass of an already instantiated body.  If I am simply working with circles and rectangles what is the best way to recalculate the MOI?  Reviewing the code I see that the BodyFactory class already contains the calculations in the CreateNBody methods.

For now I will just chop the calculations out and put them into a method that I will call from set accessor of the Mass property for the Body class.  Sound good?

Aug 22, 2009 at 1:17 PM

Sounds fine. I will make a note of this and make sure 3.0 recalculates MOI on changes to the geometry.

Aug 22, 2009 at 1:21 PM
Edited Aug 22, 2009 at 1:25 PM

For me I am simply interested in Circles and Rectangles for now.  The Body class as far as I can tell is not keeping track of what type of body it is am I missing something?  I have this done in an ObjectProperties class I have been using to make thing easier for me.  I guess I should be setting the Body type to Circle or Rectangle or something else?  

Aug 22, 2009 at 3:34 PM

That is correct. The body class does not know anything about the shape attached to it. You can use the Tag property on the Body to attach the type of body.