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);
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.