Search code examples
xnaphysicsgame-physicsfarseer

Farseer Physics XNA Geom 'Tripping'


I have an issue similar to http://farseerphysics.codeplex.com/Thread/View.aspx?ThreadId=72364

I have a rectangle player geom, and many rectangle tile geoms lined up next to each other.

Occasionally when the player geom is crossing between them he seems to clip onto the corners of the tile geom and as a result rotate over.

Even when switching the moment of inertia to infinity which prevents rotation, the player geom "hops" when it clips the edge.

Here is a screenshot of the geoms tripping image http://notspike.com/PrototypeG/trip.png

Is there any fix for this? I've tried the Farseer forums but it seems pretty inactive

Here is a link to a video using a circle geom for the player

http://www.notspike.com/PrototypeG/trip.avi


Solution

  • I would suggest that you avoid the use of small tiles placed next to each other for the level's collision geometry. For example, although visually it's clear that you're using tiles, the "floor" from the video would best be described as a long contiguous rectangle. That way, you don't have this problem at all ... floating point math is already imprecise enough and tiling collision geometry is just asking for that to go wrong :-)