Added MatrixManipulator::s/getIntersectTraversalMask(uint) to allow control

of which subgraphs should be used in intersection calculations.  Updated
Terrain,Drive and UFO manipulator to use this new flag.
This commit is contained in:
Robert Osfield
2005-03-22 21:06:06 +00:00
parent 0b2ac40fe8
commit 476a83bb9c
6 changed files with 22 additions and 1 deletions

View File

@@ -214,6 +214,7 @@ void TerrainManipulator::setByMatrix(const osg::Matrixd& matrix)
// need to reintersect with the terrain
osgUtil::IntersectVisitor iv;
iv.setTraversalMask(_intersectTraversalMask);
const osg::BoundingSphere& bs = _node->getBound();
float distance = (eye-bs.center()).length() + _node->getBound().radius();
@@ -327,6 +328,7 @@ void TerrainManipulator::computePosition(const osg::Vec3d& eye,const osg::Vec3d&
{
// compute the itersection with the scene.
osgUtil::IntersectVisitor iv;
iv.setTraversalMask(_intersectTraversalMask);
osg::ref_ptr<osg::LineSegment> segLookVector = new osg::LineSegment;
segLookVector->set(eye,endPoint );
@@ -475,6 +477,7 @@ bool TerrainManipulator::calcMovement()
// need to reintersect with the terrain
osgUtil::IntersectVisitor iv;
iv.setTraversalMask(_intersectTraversalMask);
double distance = _node->getBound().radius()*0.1f;
osg::Vec3d start_segment = _center + getUpVector(coordinateFrame) * distance;