Hi,
I'm trying to use intersect for primitive collision detection.
I load one 3DS file into my scene and test whether this object has any
intersections. The problem is following: Although ,there is only one object in
my scene, I can clearly see that this object intersects with something.
This is the code I'm using:
tankNode = osgDB::readNodeFile("c:\\3.3DS");
osg::Vec3d intersection;
osg::BoundingSphere bs = tankNode->getBound();
osg::Vec3 start = bs.center() + osg::Vec3d(bs.radius(),0.0,0.0);
osg::Vec3 end = bs.center() ;
osg::ref_ptr<osgUtil::LineSegmentIntersector> lsi = new
osgUtil::LineSegmentIntersector(start,end);
osgUtil::IntersectionVisitor iv(lsi.get());
tankNode->accept(iv);
if (lsi->containsIntersections())
{
intersection = lsi->getIntersections().begin()->getWorldIntersectPoint();
}
While I'm running this code in debugger,the values are following:
bs.center = (0,0,0);
bs.radius = 43.0
start = (43.0,0.0,0.0)
end= (0,0,0)
intersects = (12.5,0,0) and this is weird. Am I missing somthing?
Thank you!
Cheers,
Danny.
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16674#16674
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org