i'am doing something simular, and use the hit.getWorldIntersectPoint(),
I have a function: bool isPointInSceneClipped, which looks like this for me:
--------
//transform the point to rotated box coordinates
osg::NodePath nodePath;
nodePath.push_back(m_Impl->m_SceneClipBox.m_ClipBoxTransform.get());
osg::Matrix l_mat = osg::computeWorldToLocal(nodePath);
osg::Vec3 vpoint(hitpoint[0], hitpoint[1], hitpoint[2]);
vpoint = vpoint*l_mat;
//points outside the box are clipped, points in the box are not clipped
return !(vpoint.x() > m_Impl->m_SceneClipBox.m_SceneClipInfo.m_vMin[0]
&&
vpoint.x() < m_Impl->m_SceneClipBox.m_SceneClipInfo.m_vMax[0]
&&
vpoint.y() > m_Impl->m_SceneClipBox.m_SceneClipInfo.m_vMin[1]
&&
vpoint.y() < m_Impl->m_SceneClipBox.m_SceneClipInfo.m_vMax[1]
&&
vpoint.z() > m_Impl->m_SceneClipBox.m_SceneClipInfo.m_vMin[2]
&&
vpoint.z() < m_Impl->m_SceneClipBox.m_SceneClipInfo.m_vMax[2]
);
--------
the m_SceneClipBox class contains the transformation and the dimensions of
my clipbox.
the worldpoint is translated to a local coordinate, and this is tested
against the (local) clipbox dimensions.
to answer your question:
how do i get a clipNodes clipBox? so i can check if the
WorldIntersectPoint is within it?
->
store your clipbox dimensions when you specify them, translate
your WorldIntersectPoint to it's (rotated/scaled) coordsystem
so you can check that point.
Hope this is of some help,
Rene
2009/5/21 Paul Griffiths <[email protected]>
> i found out i can simple use:
>
> if (clipBox.contains(hitr->getWorldIntersectPoint()))
>
>
> how do i get a clipNodes clipBox? so i can check if the WorldIntersectPoint
> is within it?
>
> Any ideas?
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=12708#12708
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org