开发者

Manage falling using rays in Irrlicht

开发者 https://www.devze.com 2023-01-22 04:50 出处:网络
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 be

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

精彩评论

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