Mark some bodies to react on touch.

josemarin
Posts: 38
Joined: Fri Aug 12, 2005 5:37 pm

Mark some bodies to react on touch.

Post by josemarin »

Hi.

I have to detect if some body (sensor, may be invisible) was touched by another.
I must identify who touched the sensor body, to it can react to the right body (exploding, pushing, ec).

Using ghosts in this case could cause too much processing?

Thanks.

Jose
josemarin
Posts: 38
Joined: Fri Aug 12, 2005 5:37 pm

Re: Mark some bodies to react on touch.

Post by josemarin »

Well, I only need to know if the player touches some objects, so, in this case, I think that the best option is to have a ghost object attached to the player body.
winspear
Posts: 77
Joined: Thu Nov 26, 2009 6:32 pm

Re: Mark some bodies to react on touch.

Post by winspear »

Just use the void pointer available for each body using setUserPointer and getUserPointer. Since it is a a void pointer you can tag the body with anything.
User avatar
dphil
Posts: 237
Joined: Tue Jun 29, 2010 10:27 pm

Re: Mark some bodies to react on touch.

Post by dphil »