Cant get a body to accelerate past a certain value.

Topics: User Forum
Feb 13, 2011 at 12:45 PM

I recently started making a topdown cargame and implemented farseer, this is more or less the first time im using it and therefore my knowledge in the matter is very limited. The problem im having is no matter how much i ApplyLinearImpulse or set the LinearVelocity, the Car ( body ) never seems to move faster than a certian value ( i dont know what the value is).


So, to sum up: The velocity IS increasing, but the car does not move faster.

How do i fix this, or should i be going about it a different way?

If additional info is needed dont hesitate to say so.

Coordinator
Feb 13, 2011 at 12:48 PM

First off: You have scaled your world to use meters right?

If yes: Simply change Settings.MaxTranslation

If no: Scale your world to meters

Feb 13, 2011 at 12:52 PM
Edited Feb 13, 2011 at 12:53 PM

I forgot to mention im using farseer 3.0 (if this makes any differance).

I have not scaled anything that i know of, i followed a farseer-pong tutorial to understand how to set the physics up (basicly just adding a World and making bodies).

So how do i scale my world to meters?

Really appreciate the help. 

Coordinator
Feb 13, 2011 at 12:55 PM

This question comes up about 3 times each day. There are tons of info about it already.

To sum it up:

1. http://code.google.com/p/box2d/wiki/FAQ (read about conversion in there).

2. Have a look at the samples

3. Newer samples might be easier to understand. Take a look at the HelloWorld sample from the source control (to be included in FPE 3.3).

Feb 13, 2011 at 12:58 PM

Aw man, i was afraid of that.

Thanks alot anyway.

Coordinator
Feb 13, 2011 at 1:02 PM

Best practice is to decouple the graphics and physics. This enables you to have stuff like a camera that can zoom. You might not be thinking about that now as you are just playing around, trying to get a grasp of things, but later it might become essential to your game.

Once you get a grasp on the scaling, it is not a problem at all.

Feb 14, 2011 at 4:44 PM

Think ive got everything working as it should now, thanks for the help. When i asked about scaling i wasnt sure what you meant exactly, the link was sufficient for me to understand.

The scaling was the problem. 

Again, thanks :) 

Mar 14, 2011 at 8:18 AM

I'm having a similar issue.  The fact that it's an issue that supposedly comes up about 3 times each day is a red flag that it needs to be better documented.  (Also, side note: it should be made clear what units the dt of the Step() functions should be in.)

I just want a sanity check to make sure that all is as I expect it.  I'm having the same issue as the original poster except with LinearVelocity instead of impulse.  My world coordinates are the same dimensions as pixel coordinates, and I'm hitting the MaxTranslation issue.  I was a little surprised when I saw in the code that a MaxTranslation of 2.0f was "very large" and "shouldn't need to be changed", because I'm expecting my Body to be able to move at up to 500 units per second.  It looks like my best bet is just to assume meters or else modify my MaxTranslation value and hope that everything will scale appropriately, but I just want to make sure.

Thanks!

Mar 14, 2011 at 4:05 PM

Your right to assume meters. there is an unsaid rule 1 meter = 30 pixels.

Developer
Mar 29, 2011 at 4:47 PM

@mvargas:

The step function expects your dt in seconds. The scale depends heavily on your game and there really is no rule at all. Just make sure that your objects are in a range from 0.1 to 10 units in size. If a character which is 1m in size is rendered a few hundred pixels high (e.g. like in an adventure game) or just 16 pixels (like in an old school jump n' run) should not matter from a physics perspective.