I've found a very good solution for damage collision !
It's a mix of :
getSceneNodeFromCameraBB
createTriangleSelector
getMesh
I explain how i do that :
first, for speed, i do a getSceneNodeFromCameraBB for gettin the node under the camera's target (this function works with BoundBox of the mesh).
After, for seeing if the mesh is *really* under the camera's target, i'll do this (assume that faerie is a animatedmesh and node the animatedscenenode, and targetshoot the camera's target):
Code: Select all
meshSelector=smgr->createTriangleSelector(faerie->getMesh(40),node);
node->setTriangleSelector(meshSelector);
meshSelector->drop();
// TEST MORE ACCURATE
if (smgr->getSceneCollisionManager()->getCollisionPoint(targetShoot,meshSelector,inPoint,inTriangle))
std::cerr<<"BODY SHOOT !"<<std::endl;
But you'll see just one problem, a really little problem
I want to replace the faerie->getMesh(40) (an arbitrary value) with the real number of frame played at this moment, a function which be named by example getCurrentFrame ... How can i implement that ?
Thanks for your helps.
Regards.
cyb