What are the best settings for Farseer Physics 3.5 when I have fast gameplay so that Farseer Physics is very responsive during collision detection?

1 week ago 5
ARTICLE AD BOX

I use the event OnCollision to check if two bodies are touching each other and the event OnSeparation to check if two bodies are not touching each other anymore.

I use BodyFactory.CreateCircle to create a ball that moves sometimes fast. I want that the events OnCollision and OnSeparation get fired immedialtely when the ball touches another body(a few bodies have .IsSenor = true and other bodies .IsSenor = false) and when the ball doesn´t touch anymore(OnSeparation) a body.

I have read in this old stackoverflow thread that you can change the line public const float AABBExtension in the class Settings.cs from the value 0.1f to 0.01f: Farseer physics: Collision detection issues

What happens if I change AABBExtension from 0.1f to 0.01f? Does it help so that the events OnCollision and OnSeparation get fired faster?

I changed the value in Settings.cs:

/// <summary> /// This is used to fatten AABBs in the dynamic tree. This allows proxies /// to move by a small amount without triggering a tree adjustment. /// This is in meters. /// </summary> public const float AABBExtension = 0.01f;

I update the Farseer Physics World like this in MonoGame:

using FarseerPhysics.Dynamics; bool FarseerWorldPaused = false; float delta; World world; if (world == null) { world = new World(new Vector2(0, 7)); } protected override void Update(xna.GameTime gameTime) { delta = (float)gameTime.ElapsedGameTime.TotalSeconds; if ((FarseerWorldPaused == false) && (world != null)) world.Step(Math.Min(delta, (1f / 60f))); base.Update(gameTime); }

What are the best settings for Farseer Physics 3.5 when I have fast gameplay so that the Farseer Physics events OnCollision and OnSeparation get fired faster?

Read Entire Article