Description about the mass and gravity

Nov 26, 2007 at 10:23 PM
Hey crashlander,

I finally got all my calculation vectors working properly. Now i got a question how the gravity relates to the values of the mass of a body.

I used to work with the newton lib in 3d and there the gravity was 9.8.... like the actual gravity on earth. Now i looked into the default value of farseer and i saw that the y comp had a value of 150.
I what kind of metrics do i need to see those values? Like the mass of a body, if i give 5 in the constructor. Is that like 5kg?

I'm trying to figure those out to keep my ball on the landscape and not fall slowly through :P.

I have this scene now:
Ball = 5
Gravity = default (0,150)

Now the lowest value i get when it will fall though my landscape is a velocity of (0, -12). How can i make it so that the impulse will be the same and the forces pushing the ball down?

Thanks in advance!! And i really like your work!
Coordinator
Nov 27, 2007 at 11:42 AM
In order to use kg and meters you need to decide on units. Farseer doesn't define a unit. You have to do that in code. Usually if you don't set up some sort of unit conversion (50 pixels = 1m) for example then you end up using pixels as your unit. This is why gravity seems off. To use 9.8 for gravity and get it to act even somewhat correctly you will need to define a meter then convert all your pixels to meters before using them in the engine.

There is a helper class for this: ConvertUnits. It will let you setup a conversion ratio then you can easily convert between sim units and display units like so: ConvertUnits.ToSim(150).

hope this helps.
Developer
Jan 10, 2008 at 9:27 AM

crashlander wrote:

There is a helper class for this: ConvertUnits. It will let you setup a conversion ratio then you can easily convert between sim units and display units like so: ConvertUnits.ToSim(150).


Why is the parameters name displayUnits if I call the function ToDisplayUnits? Shouldn't it be simUnits or somthing like "value"? I find this a bit confusing. Putting in display units to get display units? ;-)

public static float ToDisplayUnits(float displayUnits) {
return displayUnits * _displayUnitsToSimUnitsRatio;
}
Coordinator
Jan 10, 2008 at 4:28 PM
I'll have to look at it... could just be a copy paste bug. Never noticed it.