[ODE] Bypassing customized Geoms

Nate W coding at natew.com
Thu Feb 19 20:50:47 MST 2004


On Thu, 19 Feb 2004, Terence Lewis wrote:

> I'm working on a game, which, naturally, has a number
> of different objects which collide.
> 
> The problem I'm having is that I don't know how to
> determine what GameObject type o1 and o2 are in the
> collision nearCallback function.

That's an easy one. :-)

Just do a bunch of these:
dGeomSetData (geom_id, &my_game_object);

And inside the the collision callback, do:

game_object *object1 = dGeomGetData (o1);
game_object *object2 = dGeomGetData (o2);

You'll get nulls back if you don't call dGeomSetData, which could be
reasonable for static objects like terrain, boulders, etc.

It will probably help to have all of your game objects derive from a
common base class, or use RTTI, or something like that, so you know what's
colliding with what.

ODE's bodies have a similar pair of functions, so consider that as well.

-- 

Nate Waddoups
Redmond WA USA
http://www.natew.com/




More information about the ODE mailing list