I have a problem with getscenenodeandcollisionpointfromray(), this fonctio always return a null sceneNode.
I have checked that the ray what i use cross some other nodes with draw3Dline, but the fonction getscenenodeandcollisionpointfromray() don't return a node.
I want to check all the scene.
My code (take in example 7, collision)
Code: Select all
irr::scene::ISceneCollisionManager* collMan = m_scnMgr->getSceneCollisionManager();
irr::core::line3d<f32> ray;
irr::core::vector3df p = m_perso->getNode()->getPosition();
p.X -= 20;
ray.start = m_perso->getNode()->getPosition();
ray.end = p;
irr::core::vector3df intersection;
irr::core::triangle3df hitTriangle;
irr::scene::ISceneNode * selectedSceneNode =
collMan->getSceneNodeAndCollisionPointFromRay(
ray,
intersection,
hitTriangle,
m_scnMgr->getRootSceneNode()->getID(), // or just 0
0);
if (selectedSceneNode || collMan->getSceneNodeAndCollisionPointFromRay(
ray,
intersection,
hitTriangle,
m_scnMgr->getRootSceneNode()->getID(), // or just 0
0))
cout << "The code works !" << endl;
else
cout << ":-(" << endl;
Have you got an idea of the origin of the problem ?
Thank you and sorry for my poor english.