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

[Solved] ApplyForce() has less impact without ApplyTorque()

Oct 5, 2012 at 1:28 AM
Edited Oct 21, 2012 at 7:55 AM

I am unable to recreate this in the TestBed, so there should be something wrong with my code.  I'm at a total loss after stripping it so it looks like the TestBed.



I have an object with some LinearDamping and Mass.

If I ApplyForce(moderate force), the results are expected. The object accelerates until it reaches the expected final velocity.

If I ApplyForce(small force), something weird happens. The object moves slow. If I apply a small amount of torque, it accelerates to the expected velocity. (No more torque is required.)

Any idea what causes this?



Here's some specs:

LinearDamping=1f, Gravity=0,0., Mass=40, Friction=0. AngularDamping unset.


Update(GameTime gameTime)
if (ScreenManager.Input.IsKeyDown(Keys.Space)) {

                _bdy.ApplyForce(ConvertUnits.ToSimUnits(new Vector2(50, 0))); 
            } World.Update(GM.WorldTargetTime); //TestBed shows this isn't the cause

Console without torque:

Console with torqu:
[steadily accellerates]

Console when max speed is 3, but decreases to 1
[steadily decreases]
Oct 5, 2012 at 8:37 PM

Have you tried playing with the values in Settings.cs. Perhaps it's the VelocityThreshold (speed is way below the default of 1f). 

Even if it doesn't help having relative speeds below the threshold (like with static bodies) will mean your collisions will be totally inelastic which is perhaps not what you want. Might be easier to upscale the world a bit in order to not have very low (or very big for that matter) values.

Oct 6, 2012 at 8:27 PM

Thanks Jerry, settings seems to be a good place to start.

Oct 21, 2012 at 7:53 AM
Edited Oct 22, 2012 at 8:53 AM

I've tried really hard to see if any of the FarseerPhysics.Settings tweaks would fix it. I am content that all of the variables are ok.


Is there any chance that Settings.epsilon could be the cause? It is a small number, no description, affects island solving, and a "static distance" class.

Any ideas what to lookf or?

Oct 22, 2012 at 9:14 AM
Edited Oct 22, 2012 at 9:25 AM

I think I've found something. Playing with TimeStep, force values that 'used to work' no longer work.

This is what my TimeStep looks like on Game Init

            GM.TargetElapsedTime = TargetElapsedTime.TotalMilliseconds;
            GM.TargetWorldTime = ConvertUnits.ToSimUnits(GM.TargetElapsedTime );


This is how it looks like in Update:



How do I fix my World Time Step?

Oct 22, 2012 at 9:12 PM

Try with a fixed timestep to see if that solves anything.

Example: World.Step(1/60f); //60 FPS

Also make sure that you scale your units correctly. Have a look at the Testbed and Samples framework on how to do this.

Oct 22, 2012 at 11:05 PM
Edited Oct 22, 2012 at 11:07 PM

Thanks Genbox.

It happened to be a combination of fixing World.Step(DeltaTime), and compensating the units.

This is what it looks like for me now:



All 'force' units (Damping, Velocity, Forces) are multiplied by 10