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

Density vs Mass

Topics: User Forum
May 17, 2011 at 6:40 AM
Edited May 17, 2011 at 6:40 AM


I just switched over to Farseer 3.x and everything works fine except that I used, in short, the same mass for group of different size and shape objects.

So most of my systems do not work as intended due to this problem.

As I understand it right now, the size of the object has a role in how "heavy" it is. Is there any way to ignore this concept? I do not want the size of my objects having any effect to their weight.


May 17, 2011 at 9:02 AM

When you first create a dynamic body it gets a default mass of 1. 

When you attach a fixture, the body.Mass is calculated from the density across all fixtures, as you've noticed.  To ignore this concept you can set the density of the fixtures to zero.

If I want to ignore the density calc I do this:
1) create my body, shapes, fixtures and attach them together as normal
2) as a final step I say _body.Mass = myValue.  This overrides the masses calculated from density when you attached the fixtures to the body in step 1.

May 20, 2011 at 5:24 AM

Ah, my mistake was that I tried to change the mass before I set the body to dynamic. Basically, we can't change the mass of a body unless its dynamic.

Thanks a lot!