Fw: [ODE] Callback function for Colision

Stephan Heigl steve at eisscholle.de
Sat Jan 18 04:43:01 2003


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.