getSceneNodeAndCollisionPointFromRay does not work

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
Stedy80
Posts: 5
Joined: Mon Jun 11, 2012 7:00 pm

getSceneNodeAndCollisionPointFromRay does not work

Post by Stedy80 »

Hi,

i tried to use the named function to do some collision detection in a game of mine.
Here is some test code:

Code: Select all

 
ISceneCollisionManager* cm= sceneManager->getSceneCollisionManager();
vector3df pos = getNode()->getPosition();
vector3df rayStart = pos + vector3df(0,+DIMY,0); // startPos
vector3df rayEnd = pos + vector3df(0,-DIMY,0); // end point under my node
vector3df colPoint;
triangle3df colTri;
line3df ray(rayEnd,rayStart);
IVideoDriver* driver = ... // get Video Driver
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
driver->draw3DLine(rayStart,rayEnd,SColor(255,255,255,255));
ISceneNode*n = cm->getSceneNodeAndCollisionPointFromRay(ray,colPoint,colTri,0,0);
 
as you can see, the ray should go from the y-axis top of the node, right through the node, down to its bottom.
And it does, the visualisation via VideoDriver shows the result.
But the return value of getSceneNodeAndCPFR is always 0.
Anybody an idea, what could be the problem?
The 4th and 5th parameter set to 0 should enable picking every SceneNode, I thought?
My sceneNode does also use CollisionResponseAnimators, don't know, if this could cause problems.

edit: the visualisation is not the problem, it's the same without.
smso
Posts: 246
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: getSceneNodeAndCollisionPointFromRay does not work

Post by smso »

Have you set up the selector or meta?

Regards,
smso
Post Reply