Hi,
i am trying to get eyePosition and direction, more precisely, the direction of
a ray for the purpose of ray tracing.
this is what i am doing:
Code:
const osg::Vec3d collisionPoint = intersection.getWorldIntersectPoint();
...
osg::Vec3d eyeDirection = collisionPoint - _tracer->getEye();
eyeDirection.normalize();
where the _tracer->getEye() method returns the position of the eye (computed
once for a frame):
Code:
if (!_eye_set) {
osg::Vec3d center, up;
getCamera()->getViewMatrixAsLookAt(_eye, center, up);
_eye_set = true;
}
i am not sure whether this is the correct way to get the eye
position/direction. i was thinking there has to be a way to get the direction
from an intersection itself, but i am not confident using the start/end points
(transforming them into appropriate coordinates) considering i create the rays
(line segment intersectors) in WINDOW and also MODEL coordinate frames.
can anyone tell me whether my method is correct or i should rather try getting
the start/end points from the intersector, transforming them and this way
getting the ray (==eye) direction ?
Thank you!
Cheers,
Andrey[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=46123#46123
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org