[ODE] Sensors in ODE

Megan Fox shalinor at gmail.com
Fri Feb 25 20:34:19 MST 2005


Here's how I handle that case:

In my collision callback, I do all the usual rules for early rejection
(ghost body comparisons, rejection of two geoms on the same body,
rejection of static<->static, etc - I also reject ray<->ray
collisions), then I determine what sort of geom each is.

If the geom is a ray, I know that I've set the user data pointer to my
own custom "sensor" structure (normally, the user data pointer points
to my entity), so I grab that out for the sensor.  I run the collision
(not adding any contact joints, of course, since the contact from a
ray isn't terrifically useful in a physical sense), and update my
sensor structure with the entity it collided, collision positions, so
on and so forth.

You'd just need to add a bit of logic in there to handle your
no-collision cases once you'd determined it was a ray (and grabbed the
data structure that tells you what it collides with), and you'd be
set.


-Megan Fox
> Any ideas on how to accomplish this? Anyone here done
> something similar?


More information about the ODE mailing list