[ODE] Bypassing customized Geoms

Jonas Svegland svegland at customred.com
Thu Feb 19 21:23:57 MST 2004


There is another way for you to know wich geoms that are colliding.
You can use the functions dGeomSetData (dGeomID, void *) and 
dGeomGetData (dGeomID) to set a pointer in your geoms to point at the 
corresponding gameobject. This way you can easily get the void pointer 
in your nearCallback and type cast it to your  gameobject. Hope this 
helps, although I didn't explain how to inherit dBoxClass.


Jonas Svegland
Custom Red Software Studios
svegland at customred.com

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.
>I'd like to use this function to determine different
>collision response based on the types of GameObjects
>that are colliding.
>Currently, I'm just using Boxes for the Geom's for all
>my objects, as I've already computed bounding boxes
>for the objects. This works well, except that
>obviously o1 and o2 are dBoxClass, which doesn't help
>Now, rather than define a whole bunch of new Geom's
>(one for every GameObject in my game), I was wondering
>if it's possible, and how difficult it would be, to
>inherit all the collision code from dBoxClass and just
>change the class number for each new object I need.
>This would allow me to check which of my objects o1
>and o2 are. And, this way, I won't have to copy/paste
>the dBoxClass collision code, and figure out how to
>add custom geoms when the functionality I need is
>already there.
>So basically : Is there an easy way to inherit all the
>properties of dBoxClass in a new sub-class, with the
>only change being a new Class number?
>We scratch, our eternal itch
>A twentieth century bitch
>And we are grateful for
>Our Iron Lung
>Do you Yahoo!?
>Yahoo! Mail SpamGuard - Read only the mail you want.
>ODE mailing list
>ODE at q12.org

More information about the ODE mailing list