Hi Sergey, >then create custom intersector to suite your needs see custom intersectors >Thanks for giving entry point, the chapter in Cookbook also suggest to do so, >I came to know that recently. One more little question, I created a XY grid (Z=0) which is composed of PrimitiveSet with GL_Lines, how can one implement the snaping to the lines intersection points(intersection between line segments), IMHO thereis no need to create custom intersector to detect that and picking lines is unnecessary. As a result mouse may hoover anywhere in vast spatial space and may not detect the intersection point. How am I supposed to proceed with that ? Entry point will be appreciated. Regards,
Date: Sun, 27 Jul 2014 00:59:01 +0400 From: sergey.fo...@gmail.com To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Mouse World Position in Perspective View Hi Sonya >but what happens if mouse is close enough and supposed >to be snapped to >vertex but mouse is not on object.? I can think of two things - set bounding sphere to be larger so that you intersect object when you click near object ( see http://vtp.googlecode.com/svn-history/r7601/trunk/TerrainSDK/vtlib/vtosg/NodeOSG.cpp as an example), then create custom intersector to suite your needs see custom intersectors here http://www.packtpub.com/sites/default/files/downloads/6884_Chapter10.pdf Regards Sergey On Sat, Jul 26, 2014 at 11:11 PM, Sonya Blade <sonyablade2...@hotmail.com> wrote: 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 cookbook Ch3 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 _______________________________________________ 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