Page 1 of 1

[Solved] How to get Collision between two scene nodes?

Posted: Tue May 19, 2009 10:00 pm
by Kalango
Hello,
I'm trying to get the current collision state between two scene nodes( aniamted meshs x camera and anim mesh x anim mesh) so i can say what happens when they collide. I want to do something like this.:

Code: Select all

if( a->isColliding(b))
       {//  do something }
i tried teamAlpha's code but i didnt seem to work..:

Code: Select all

static inline bool isInsidePoint(ISceneNode* a, ISceneNode* b)
{
       //temp
   a->updateAbsolutePosition();
   b->updateAbsolutePosition();
   return a->getTransformedBoundingBox().isPointTotalInside(b->getPosition());
}

static inline bool collidesWith(ISceneNode* a, ISceneNode* b)
{
       //temp
   a->updateAbsolutePosition();
   b->updateAbsolutePosition();
   return a->getTransformedBoundingBox().intersectsWithBox(b->getTransformedBoundingBox());
}
and irrlicht doesnt seem to have some sort of isColiding method....

Thanks!!

PS: This is NOT about triangle selectors, metaselectors or CollisionResponseAnimators............

Posted: Tue May 19, 2009 11:22 pm
by B@z
why didnt the second one work?

it should work...

Posted: Wed May 20, 2009 6:20 am
by Strong99
Its possible that the bounding box has the wrong scale, make the bounding box show in your scene, and check if they realy collide or that the bounding is to small.

Posted: Wed May 20, 2009 2:42 pm
by Kalango
I tried to check the bounding box, the scene node bbox seems normal, but it still does not work. Its odd because when the camera is in some random orientation it acuses false collision, otherwise its always true...
let me show some SS:
Image
Image

Btw, collision is between scene node and fps camera

Posted: Wed May 20, 2009 3:15 pm
by Kalango
Solved the problem, it seems that the camera bounding box is messed up so i atached a box to it and checked the collision, and it worked :p

thanks for the help guys....