Thanks Edge, Erin and everryone for help.
Edge wrote:Sensors are useful if you don't want to calculate the angle of collision yourself, so you know the contact came from the right, left, etc (work around without sensors is to calculate angle of collision yourself with the real shape), or to provide some buffer, so you know a collision with the real shape is coming up or is close enough to count, say for grabbing.
I'm trying to do it using sensors, following your suggestions. But I have some problems. Erin tells sensors only generate ADD and REMOVE, but I have a strange result. I have a character with a sensor, I move it close a wall, if sensors intersects with the wall, I see an ADD response, but if I continue walking to the wall I receive an ADD and REMOVE event, but my sensor is still over the wall, however when I go back I receive an REMOVE event. Why I receive ADD and REMOVE in the middle??? If you see attached pictures you will understand it. Please take a look.
Edge wrote:Whether you use them or not, you are still dependent upon the contact listener. For reactions (i.e. hitting a wall), I would think you should be able to do that on the contact add. For status type events (i.e. am I standing on the ground so I can jump), I keep a counter that I increment on contact adds and decrement on removes. So a status check is just checking whether my count is greater than 0 or not. Downside is I have to keep a counter for everything I want a status on. And for some reason the count do get flaky over time on some occasions.
Does that apply also to sensors? In this case, I guess that is the problem I am having, am I right?
@Erin: Is a bad idea to use 3 sensors (right, left botton) on all my characters if I'm going to use a not too much powerful device (iPhone)?, I mean, computationally. Or should I really consider using contact point and test their normals?
Apart from useful Edge links, does anyone know more info about how to post-process contacts? Box2D is easy to use, but contacts are a bit difficult to manage.
Thanks in advance.