[osg-users] [forum] Can't use osgUtil::RayIntersector

Andrey Skvortsov starling13 at mail.ru
Wed Sep 28 02:47:43 PDT 2016


Hi,

Can't make simple example with the RayIntersector to work.

[code]
...
if (_node.valid()) {
  _rayIntersector->setStart(_eyePosition);
  _rayIntersector->setDirection(-newUp);
  _rayIntersector->setIntersectionLimit(osgUtil::Intersector::LIMIT_ONE);

    std::cout << "start: " << _eyePosition << ", direction: " << -newUp << std::endl;
    _node->accept(*_intersectVisitor);
    if (_rayIntersector->getIntersections().size() == 1)
        std::cout << "intersects" << std::endl;
    else
        std::cout << "not intersects" << std::endl;
}
[/code]

On simple 2 triangles plane model there is an error message:

[code]
start: 0 -23.4985 0, direction: 0 -1 -0
not intersects
Warning:: Picked up error in TriangleIntersect
   (10 -24.2973 -10,	10 -24.2973 10,	-10 -24.2973 -10)
   (-nan,	-nan,	-nan)
Warning:: Picked up error in TriangleIntersect
   (10 -24.2973 10,	-10 -24.2973 10,	-10 -24.2973 -10)
   (-nan,	-nan,	-nan)
[/code]

Thank you!

Cheers,
Andrey

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68806#68806








More information about the osg-users mailing list