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

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Kalango
Posts: 157
Joined: Thu Apr 26, 2007 12:46 am

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

Post 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............
Last edited by Kalango on Wed May 20, 2009 3:15 pm, edited 1 time in total.
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

why didnt the second one work?

it should work...
Image
Image
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post 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.
Kalango
Posts: 157
Joined: Thu Apr 26, 2007 12:46 am

Post 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
Kalango
Posts: 157
Joined: Thu Apr 26, 2007 12:46 am

Post 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....
Post Reply