Fixed handling of cases when no matrix is attached to intersections
This commit is contained in:
@@ -100,7 +100,8 @@ void HeightAboveTerrain::computeIntersections(osg::Node* scene, osg::Node::NodeM
|
||||
if (!intersections.empty())
|
||||
{
|
||||
const osgUtil::LineSegmentIntersector::Intersection& intersection = *intersections.begin();
|
||||
osg::Vec3d intersectionPoint = intersection.localIntersectionPoint * (*intersection.matrix);
|
||||
osg::Vec3d intersectionPoint = intersection.matrix.valid() ? intersection.localIntersectionPoint * (*intersection.matrix) :
|
||||
intersection.localIntersectionPoint;
|
||||
_HATList[index]._hat = (_HATList[index]._point - intersectionPoint).length();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,8 @@ void LineOfSight::computeIntersections(osg::Node* scene, osg::Node::NodeMask tra
|
||||
++itr)
|
||||
{
|
||||
const osgUtil::LineSegmentIntersector::Intersection& intersection = *itr;
|
||||
intersectionsLOS.push_back( intersection.localIntersectionPoint * (*intersection.matrix) );
|
||||
if (intersection.matrix.valid()) intersectionsLOS.push_back( intersection.localIntersectionPoint * (*intersection.matrix) );
|
||||
else intersectionsLOS.push_back( intersection.localIntersectionPoint );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user