开发者

Manage falling using rays in Irrlicht

In my game i'm currently working on, i only need very basic physics, so i don't want Newton, ODE, Bullet or similar. I basically only want to fall as long as no node (all equally sized blocks) is beneath me. I tried to send a ray from the camera and 100.0 units downwards. But it gives false positives.

selectedNode = NULL;

    //Falling
    ray.start = camera->getPosition();
    ray.end = vector3df(ray.start.X, ray.start.Y - 100.0f, ray.start.Z);
    selectedNode = collMan->getSceneNodeAndCollisionPointFromRay(ray, intersection, hitTriangle, PICKABLE);

    if(selectedNode)
    {
        std::cout << "ABOVE" << std::endl;
    }

I don't know why this malfunctions. I'm using Irrlicht, but that shouldn't really matter as i think the problem is realted to logics and开发者_如何学编程 not specifically to the renderer/engine.


irrlicht has source code available. I would try tracing into the code in debug mode and see what it's doing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜