Hello!
How to I cast a ray from the camera to the sun node and check it is actually visible and nothing stands between camera and that node???
thanks
How to I cast a ray from the camera to the sun node
Take the absolute positions of the camera and the sun and use them to create a ray from the camera to the sun. Then use the scene collision manager to find if there is any node whose bounding box is intersected with that line.
Classes and functions you will need to use...
ISceneNode::getAbsolutePosition()
ISceneCollisionManager::getSceneNodeFromRayBB()
That should be good enough to help you find your way.
Classes and functions you will need to use...
ISceneNode::getAbsolutePosition()
ISceneCollisionManager::getSceneNodeFromRayBB()
That should be good enough to help you find your way.
Code: Select all
core::line3d<f32> line;
line.start = camera->getPosition();
line.end = sun->getPosition();
core::vector3df intersection;
core::triangle3df tri;
if (!smgr->getSceneCollisionManager()->getCollisionPoint(
line, selector, intersection, tri))
//draw sun flare here