Collision detection with more objects
Posted: Wed Jan 07, 2009 8:41 pm
hello,
I have a problem with collision detection ... I have two (or more in the future) "ISceneNode". I have two objects, and for both i want same collision.
My code:
This is code with collision detection:
Sorry for my english... Thanks for answer
I have a problem with collision detection ... I have two (or more in the future) "ISceneNode". I have two objects, and for both i want same collision.
My code:
Code: Select all
scene::ISceneNode* bedna = smgr->addCubeSceneNode(20);
bedna = smgr->addCubeSceneNode(); // first cube
bedna->setMaterialTexture(0, driver->getTexture("data/images/bedna.jpg"));
bedna->setMaterialFlag(video::EMF_LIGHTING, false);
bedna->setPosition(core::vector3df(300,20,150));
bedna->setScale(core::vector3df(3,3,3));
bedna = smgr->addCubeSceneNode(); // second cube
bedna->setMaterialTexture(0, driver->getTexture("data/images/bedna.jpg"));
bedna->setMaterialFlag(video::EMF_LIGHTING, false);
bedna->setPosition(core::vector3df(350,20,150));
bedna->setScale(core::vector3df(3,3,3));
// for both want to have the same collision detection
Code: Select all
scene::ITriangleSelector* select_bedna
= smgr->createTriangleSelectorFromBoundingBox(bedna);
scene::ISceneNodeAnimatorCollisionResponse *bedna_g = smgr->createCollisionResponseAnimator(
select_bedna,
node,
vector3df(20, 26, 20),
vector3df(0, 0, 0),
vector3df(0, 0, 0),
0.00080f);
node->addAnimator(bedna_g);
bedna_g->drop();