Unstable physics

Oct 13, 2011 at 9: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 2: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 8, 2011 at 11:48 PM

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 11:59 AM

Timer t=new Timer();

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

Nov 11, 2011 at 4:18 PM
Edited Nov 11, 2011 at 4: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 8:27 AM

try to enable CCD if its needed

Nov 12, 2011 at 10:37 PM
Edited Nov 12, 2011 at 10: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 2: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 9: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 2:07 PM
Edited Nov 13, 2011 at 2:07 PM

I always had ContinuousPhysics set to true.