[ODE] nearcallback pointer help
Vortex 2
vortex2 at gmail.com
Sun Nov 5 19:34:41 MST 2006
>
> I do it a differerent way.
First in my class header I have this:
static void nearCollision(void *data, dGeomID o1, dGeomID o2);
void CollisionCallback(dGeomID o1,dGeomID o2);
Now I have this code in my source file:
In my class I have an update method and in that update method I have this:
dSpaceCollide(mSpace,this,&nearCollision);
Then I define nearCollision like this:
void PhysicsWorld::nearCollision(void*data,dGeomID o1,dGeomID o2)
{
PhysicsWorld*pThis=(PhysicsWorld*)data;
if(pThis)
{
pThis->CollisionCallback(o1,o2);
}
}
Then I have my actual collision callback:
void PhysicsWorld::CollisionCallback(dGeomID o1, dGeomID o2)
{
//collision code here and stuff.
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20061105/cb2020bc/attachment.htm
More information about the ODE
mailing list