Collisions data problem

majc

13-03-2008 20:46:29

Im casting a ray against a ogrenewt body, how i know if that body is an enemy or an object? How can i know what kind of body am i hitting?

majc

14-03-2008 00:23:00

I found the answer, when i create a body i use body->setType() and then when i want to know what kind of body i hit i use body->getType(), for example:

if (body->getType() == TYPEPLAYER)
Do something ...


I hope this helps someone :)

dbrock

24-03-2008 04:27:43

you can also use userData to return the object (ie the player, or the enemy class)