[ODE] Question about collision detection
ron taņeza
ron.13 at lycos.com
Fri Dec 28 03:58:01 2001
Hi,
I'm modifying test_buggy.. I added a wall (actually a box), and when the buggy collides with it, it should move in the opposite direction. I did this (in SimLoop):
..
dSpaceCollide (space,0,&nearCallback);
int j;
dContact contactwall[10];
j = dCollide (wall1,geom_group,10,&contactwall[0].geom,sizeof(dContact));
//wall1 is of type static dGeomID
if (j>0)
{
speed = -speed;
dsPrint("Collided with wall!\n");
}
dWorldStep (world,0.05);
..
It doesn't work. I mean, the buggy still bumps the wall, but it doesn't change direction. I also tried adding the code above to the NearCallBack function, but without success. Is there a function that takes just two dGeomID arguments, and returns nonzero if those two collide? Maybe I placed my code in the wrong place? I don't fully understand collision detection in ODE, as I'm really new to physics/game programming. If anyone can show me how to do something like.. if (buggy bumps wall), then do (something).. I'd really appreciate it.
Help!
--
Click here for your very own create-a-date adventure from MatchMaker
Go to http://ecard.matchmaker.com/dating.html