Hi Sergey, Thanks for the tutorial, but I believe that the problem is: Casted ray with world_mouse = screen_mouse*inverse(MVPW)matrix manipulation is unware of whether it crossed an object or not, it simply returns near/far points of frustum.On the other hand using, the" LineSegmentIntersector >> getWorldIntersectionPoint() " and example in OSG cookbookCh3 Selecting a point on the model solves the issue of what is behind the mouse but I believe that it has drawbacks. Because this tecnique requires the mouse to be hoovered on object, but what happens if mouse is close enough and supposed to be snapped to vertex but mouse is not on object.? The above is my intuitive reasoning , I tried to put it in succinct manner and hope that I well versed it. If it is not clear I'll try to ealaborate it with images. Regards,Date: Sat, 26 Jul 2014 14:11:38 +0400 From: sergey.fo...@gmail.com To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Mouse World Position in Perspective View
Hi Sonya, I think you could solve your problem if you understand theory what goes during the whole process and test if anything works from simplest examples, then after tests you'll uncover a problem for theory I think following to links are useful, but see not only first link, but also second http://www.mvps.org/directx/articles/rayproj.htm http://www.mvps.org/directx/articles/improved_ray_picking.htm Regards Sergey On Sat, Jul 26, 2014 at 1:53 AM, Sonya Blade <sonyablade2...@hotmail.com> wrote: Dear All, I'm having a hard time getting the correct results for the mouse position in world coordinates.The problem is: retrived world mouse position is not even close to those when I hoover over an object so I couldn't find any correlation between to which vertex of object is mouse close to. To obtain the world mouse position I use world_mouse = screen_mouse*inverse(MVPW), for obtaining the vertex position I use LineSegmentIntersector >> getWorldIntersectionPoint() and there is absolutey not any coherent value that I can find any relation. My aim was to snap the mouse to the closest vertex in object, but produced results are as follow. world coords vertex(6.97538 20.55 18.7482" local coords vertex(0.876922 -3.74963 4"Mouse Position -101.794 44.6545 -130.128" Your help will be appreciated, _______________________________________________ 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