Collision Detectors

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
devil2k
Posts: 6
Joined: Thu Mar 24, 2005 9:32 am

Collision Detectors

Post by devil2k »

Hey guys, this is a great engine
I tried out the 3dstate engine before I started looking into Irrlicht and I think Irrlicht's easy to learn and looks better also
anyway, I'm doing a project for my software engineering class.
my team is to design a bomberman-liked game
it's 2-player so i loaded 2 characters into a pk3 map and assigned the SKeyMap to one of 'em for now
it works out good without adding the collision detector to it, but when i do that, the character would lags for a while and then all a sudden move for a long distance.
here's a part of my code

*******************************
selector=0;
if(levelnode){
selector = smgr->createOctTreeTriangleSelector(levelmesh->getMesh(0),levelnode,128);
levelnode->setTriangleSelector(selector);
selector->drop();
}
*******************************
anim1 = smgr->createCollisionResponseAnimator(selector,bomber1_node,vector3df(12,6,12),vector3df(0,-1,0),vector3df(0,0,0));
anim2 = smgr->createCollisionResponseAnimator(selector,bomber2_node,vector3df(12,6,12),vector3df(0,-1,0),vector3df(0,0,0));

bomber1_node->addAnimator(anim1);
bomber2_node->addAnimator(anim2);

anim1->drop();
anim2->drop();
*******************************

I first started with one character with the collision detector, it works out great
so i import another character into it and apply the collision detector, it lags and would suddenly move to the other side of the level.
then i treid disabling the detector, the character could move around very smoothly altho it could run into boxes and walls

would you guys give me some hint how to solve this problem?
thanks guys, i appreciate it :lol:
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

Post by cartoonit »

You need to use a meta triangle selector, and add all the nodes to it using the createTriangleSelectorFromBB() function... (Then have 1 response animator, because I don't think you can have two, well with MSVC 7.0 I always got errors I think when I used it like that), but it was a few months ago.

Also another thing to note is that Irrlicht collision detection is relatively slow, because it uses bounding boxes, but is good for starting off with...

I would search the forums, for collision between two characters because this has been answered many times before...
devil2k
Posts: 6
Joined: Thu Mar 24, 2005 9:32 am

Post by devil2k »

thanks buddy
i got it fixed but it's my code that causes the problem
and hey, i found out that you can have 2 animators assigned to the same selector and then do collision detection on that
works great ;)

thanks anyway tho..i appreciate it
Post Reply