Collision bug?

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
BraX
Posts: 36
Joined: Fri Jul 16, 2010 4:39 pm

Collision bug?

Post by BraX »

Hey im using triangle selector for detecting collision but im stuck at one point. I'm using meta selector to add new collision.

BPS is solid but i cannot get this one working:

Code: Select all

               	IAnimatedMeshSceneNode* model = smgr->addAnimatedMeshSceneNode(smgr->getMesh("models/test_anim.md3"));
                model->setPosition( pos - (0,0,50));
                //model->setFrameLoop(1,10);
               // model->setAnimationSpeed(15);
                model->setLoopMode(false); // or true if you want to loop the animation
                model->setMaterialFlag(EMF_LIGHTING, true);

                model->setTriangleSelector(smgr->createTriangleSelector(smgr->getMesh("models/test_anim.md3"), model));
                metaSelector->addTriangleSelector(model->getTriangleSelector());

Code: Select all

Camera:
	ISceneNodeAnimatorCollisionResponse* playerCollision = smgr->createCollisionResponseAnimator(metaSelector, camera, core::vector3df(15,64,15), core::vector3df(0,-15,0));
    camera->addAnimator(playerCollision);
	playerCollision->drop();
RuggJack93
Posts: 39
Joined: Mon Sep 06, 2010 5:09 pm
Location: Italy

Post by RuggJack93 »

I'm not sure if collision detection can be done using a normal triangle selector on an animated mesh scene node. For animeted nodes i would go rather with a bounding box triangle selector. Try subsitute your

Code: Select all

model->setTriangleSelector(smgr->createTriangleSelector(smgr->getMesh("models/test_anim.md3"), model)); 
with

Code: Select all

model->setTriangleSelector(smgr->createTriangleSelectorFromBoundingBox(model); 
BraX
Posts: 36
Joined: Fri Jul 16, 2010 4:39 pm

Post by BraX »

Ok that worked, thanks :)
Post Reply