[ODE] Bypassing customized Geoms

Rob Ruck bobruck at btinternet.com
Thu Feb 19 19:35:57 MST 2004


You could do all that... but, baring in mind, all you seem to want to do is 
differentiate between objects, you could do:

- Add an extra callback in for you're nearcallback, game specific, where you 
can compare bodies. Have it as a bool return, if it returns true continue with 
collision, false don't bother.

- Make use of the geom/bodies user data members, that's what they're there 
for, dgeomsetdata() & dbodysetdata(). You can pass these functions any kind 
of data, this user data is then available anywhere that the body/geom is, 
dgeomgetdata() & dbodygetdata(). i.e.

typedef struct
{
..
} blah;

blah fnar;
blah *fnar2;

void main()
{
 dBodySetData(bodyID, &fnar);

 fnar2=dBodyGetData(bodyID);
}

On 19 Feb 2004 at 11:07, Terence Lewis wrote:

> Hi...
> 
> 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
> me.
> 
> 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?
> 
> Thanks
> 
> =====
> 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.
> http://antispam.yahoo.com/tools
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode

--
Rob Ruck
mailto:bobruck at btinternet.com



More information about the ODE mailing list