Ladders (Sensors)

Topics: User Forum
Feb 22, 2012 at 6:46 PM

As I wrote in another thread, I'm trying to figure out how to port the logic of a tile based platform game to Farseer.

An issue that popped up is the ladders: currently the tile map is scanned and all ladders are extracted; eventually they get turned into a single object (EarclipDecomposer + CompoundPolygon) and the whole thing is flagged as a sensor.

Works great... but: in the tile world, knowing where the ladder is allows to recenter the character when he goes up and down, so if you enter the ladder and don't line up properly, it's easy to recenter the character.

In this case, it is a bit harder because the ladder is really a compound poly so it is a bunch of rectangles and I do not get a collision manifold as the ladder is a sensor (to not affect anything).

I'm trying to find out:

- how I can get a collision point from a body / sensor collision

- is there a speed disadvantage to have all ladders as a compound body? overall everything is inside that big body all the time, so I assume collisions must be done constantly against all rectangles (ladders) inside. Would it be better to make the ladders separate sensor objects? (thus simplifying the collision as well)

Feb 23, 2012 at 3:44 PM

 I'm not sure but if i'd say ,that if you separate the Ladders it will definitely simplify the collision (as you said ) and will give you an exact position for the ladder ,with which you can definitely get the collision point and the offset required to center your char .

Feb 24, 2012 at 9:48 PM

That has worked really well!