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

Unstable physics

Oct 13, 2011 at 10:47 PM

I am rendering into a form and I don't know what is happening that If I drop an object on top of another  it goes a little bit throught it,

and some times a lot. I can't figure out what it is. It's very unstable when I run it inside a window. Withougth using the Game class.


Are there any settings that can cause this?

Will the time step affect this?

Nov 8, 2011 at 3:23 PM

time step affect it a lot

try to use sub steps or lower the timer timeout (so you get around 30-60 FPS for the physics)

Nov 9, 2011 at 12:48 AM

I am using my own timer because I could not figure aut how to start an XNA gametime. How would be the best way (farsser physics wise) to set up a timer by your self?

Because I tried sub steps and it still does it! How would I lower the timer timeout?

Nov 9, 2011 at 12:59 PM

Timer t=new Timer();

t.Interval= (1000/FPS); //1sec * 1000 for ms / FPS

Nov 11, 2011 at 5:18 PM
Edited Nov 11, 2011 at 5:55 PM

Thanks, I was able to isolate more the problem.

Objects will only go a little bit througth another one if both objects are no statics.

It only happens if both objects are dinamic objects

Nov 12, 2011 at 9:27 AM

try to enable CCD if its needed

Nov 12, 2011 at 11:37 PM
Edited Nov 12, 2011 at 11:38 PM

Also, make sure that you set the isFixedTimeStep to true when loading the game.
Irregularities in the frame rate may cause the objects to appear as overlapping.

Also try setting  graphics.SynchronizeWithVerticalRetrace to true.

Nov 13, 2011 at 3:53 AM

It that I can't set graphics.SynchronizeWithVerticalRetrace to true, because I am not running a game window and had to create everything by hand.

I did not finad a way to create a GraphicsDeviceManager, and the graphicsDevice does not has that setting!

Nov 13, 2011 at 10:37 AM

what Kirima said will not work because

graphics.SynchronizeWithVerticalRetrace only works if IsFixedTimeStep is false

make sure that ContinuousPhysics = true; (in Farseer / Settings)

Nov 13, 2011 at 3:07 PM
Edited Nov 13, 2011 at 3:07 PM

I always had ContinuousPhysics set to true.