Fw: Fw: [ODE] Callback function for Colision

Christian Gilman oneill at future-bytes.com
Sat Jan 18 11:52:41 2003


Thanks all.

I made it with singleton.


----- Original Message -----
From: "Stephan Heigl" <steve@eisscholle.de>
To: <ode@q12.org>
Sent: Saturday, January 18, 2003 12:51 PM
Subject: Re: Fw: [ODE] Callback function for Colision


> I also use a singleton:
>
> class Simulation : public Singleton<Simulation> {
> ....
> static void nearCallback(...)
>
>
> and then
>
> void Simulation::nearCallback( void *data, dGeomID o1, dGeomID o2 )
> {
>   dBodyID b1,b2;
>   b1 = dGeomGetBody(o1);
>   b2 = dGeomGetBody(o2);
>   if (b2 && b2 && dAreConnected (b1,b2)) return;
>
> list<DynamicsEntity *>::iterator it =
> Simulation::Instance().m_Entities.begin();
> while( it != Simulation::Instance().m_Entities.end() )
> {
> (*it)->Collide( data, o1, o2 );
> ++it;
> }
>
> }
>
> On Saturday 18 January 2003 12:26, Chris Brodie wrote:
> > Another option I use, is a singleton within the Collision testing
function.
> > The collision test func can then instance my Dynamics class that holds
> > things like the world \ spaces etc...
> >
> > -----Original Message-----
> > From: gl [mailto:gl@ntlworld.com]
> > Sent: Saturday, 18 January 2003 10:13 PM
> > To: ode@q12.org
> > Subject: Re: Fw: [ODE] Callback function for Colision
> >
> >
> >
> > One option is to store the class instance pointer in your geoms using
> > dGeomSetData().  Then use a global callback function as suggested, check
> > for the class the input geoms belong to, and redirect the callback to
the
> > class specific handler.
>
>
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode