I have a question about collision detection as you can see from the 2 images I have posted, the triangles are being drawn and collision is being detected...however it is not being updated as the mesh is being animated.
I tried:
GATEselector = smgr->createTriangleSelectorFromBoundingBox(GATEnode);
...but it didn't give me any triangles on the gate, is this because I havn't called a bounding box for my GATEnode?
Code: Select all
// add Gate,
scene::IAnimatedMeshSceneNode* GATEnode = 0;
scene::IAnimatedMesh* gate = smgr->getMesh("../../media/CASTLEGate.x");
GATEnode = smgr->addAnimatedMeshSceneNode(gate);
GATEnode->setMaterialFlag(video::EMF_LIGHTING, false);
scene::ITriangleSelector* GATEselector = 0;
if (GATEnode)
{
GATEselector = smgr->createOctTreeTriangleSelector(gate->getMesh(0), GATEnode, 128);
GATEnode->setTriangleSelector(GATEselector);
GATEselector->drop();
}
Code: Select all
if (smgr->getSceneCollisionManager()->getCollisionPoint(
line, GATEselector, intersection, tri))
{
bill->setPosition(intersection);
driver->setTransform(video::ETS_WORLD, core::matrix4());
driver->setMaterial(material);
driver->draw3DTriangle(tri, video::SColor(0,255,0,0));
}