Page 1 of 1

other ways for collision detection

Posted: Thu Jul 20, 2006 6:54 am
by irrlicher
Hello everybody!I have a question about collision detection:
I know how to create CollisionResponseAnimator but it only checks the collision and repsonse the object by not moving it.But i want to when my camera collides with an object i want that object disappear.I've tried many things but i couldn't do it. :(
And that was my code:

Code: Select all

if (camera->getPosition()==object->getPosition)
{
//blablabla
}
But it only works when i get very close to get the object.
How can i do it?Thanks in advance!

Posted: Thu Jul 20, 2006 7:11 am
by area51
You could try something like this:

Code: Select all

if( object->getPosition().getDistanceFrom(camera->getPosition()) < 100)
{
// blablabla
}
100 is the trigger region, increase or decrease this as required
________
Colorado Medical Marijuana Dispensaries

Posted: Thu Jul 20, 2006 9:48 am
by irrlicher
That worked well now!Thanks area51!! :)