Hi Tanguy,

The best thing to do would be to modify the OSG code and send it to me
via osg-submissions list.  At that point I can review the changes and
get my head around the problem you are trying to address in context.
I have to jump between dozens of different topics each day so having
things in form that I can easily get my head around is important.

Thanks,
Robert.

On Thu, Dec 4, 2008 at 4:17 PM, Tanguy Fautre
<[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I think I found the bug. Fixed implementation attached.
>
> If you look at the implementation of the function 
> osgViewer::View::computeIntersections() taking the nodepath argument, you'll 
> see that it compute the LocalToWorld transformation using the complete given 
> path.
>
> But this is incorrect if the last node of the path is a transformation. In 
> which case the last transformation is applied twice before computing any 
> intersections.
>
> I've currently copy/pasted the current implementation and changed it to a 
> standalone function so that I could test and use it as a fixed version 
> without modifying OSG code. See attachment.
>
>
> The two important lines are:
>
> const osg::NodePath shortPath(nodePath.begin(), nodePath.end() - 1);
>
> osg::Matrix matrix = osg::computeLocalToWorld(shortPath) *  
> camera->getViewMatrix() * camera->getProjectionMatrix();
>
>
> Robert, if you agree with these modifications, what should I do for them to 
> be integrated back into the trunk?
>
>
> Cheers,
>
> Tanguy
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tanguy Fautre
> Sent: Friday 28 November 2008 15:21
> To: osg-users@lists.openscenegraph.org
> Cc: Neil Groves
> Subject: Spam: [osg-users] View::computeIntersections with a node path
>
> Hi,
>
> Has anyone been able to successfully use
> osgViewer::View::computeIntersections() taking a node path argument on a
> non-trivial scenegraph?
>
> I currently have a fairly complex scenegraph, but I only want a small
> part of it to collide with computeIntersections. When I use
> computeIntersections without the nodepath, everything works perfectly.
> But as soon as I use the overload with the node path, I get an empty
> intersection set. I'm pretty sure the node path I'm giving is correct.
>
> Looking at the implementation of computeIntersections() with the node
> path, the only thing that puzzles me is the use of
> osg::computeWorldToLocal(nodePath) before computing the matrix inverse,
> I'm not sure I fully understand why this is the case. It seems to me the
> whole operation should be LocalToWorldMatrix * ViewMatrix *
> ProjectionMatrix instead.
>
> In any case, if anyone has a working example (which would show
> computeIntersections() with a node path is working correctly, or help
> finding the mistake I'm doing), it would be appreciated.
>
>
> Regards,
>
> Tanguy
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to