In my case its Perspective.

I was able to work around the problem by using a PolyTope intersector with 
a 1x1 rectangle. That worked perfectly.

On Tuesday, April 14, 2020 at 11:56:24 PM UTC-7, OpenSceneGraph Users wrote:
>
> Hi Andrew,
>
> When you say you have a isometric view, to be clear, you mean you have an 
> orthographic projection of the scene?  The OSG itself support orthographic 
> projection via the osg::Camera's ProjectionMatrix, the intersection.  It 
> can only account for this if the IntersectionVisitor knows about it's 
> setting.  
>
> Have you tried the osgViewer::View(er)::computeIntersections(..) method?
>
> This method knows about the View's Camera so can account for it's 
> projection matrix.
>
> Robert.
>
> On Tue, 14 Apr 2020 at 23:35, OpenSceneGraph Users <
> osg-...@lists.openscenegraph.org <javascript:>> wrote:
>
>> Hi,
>> I am having a lot of problems with picking with LineSegmentIntersector in 
>> OSG 3.6.5.
>>
>> I have reduced the problem to a a simple cube, center 0.5,0.5,0.5 with a 
>> boundingSphere radius of 1.2142
>>
>> I create the intersection with ( x , y are screen coordinates)
>>
>> picker=new osgUtil::LineSegmentIntersector ( osgUtil::Intersector::WINDOW
>> , x, y );
>> osgUtil::IntersectionVisitor iv ( picker );
>> getCamera()->accept ( iv );
>>
>>
>>
>> When I am "close" to the model geometry in an isometric view ( the cube 
>> fills,say, 50% of the screen), this works perfectly. I get the exact 
>> intersections coordinates I expect.
>>
>> When I "pull the camera back" from the geometry and the object is much 
>> smaller on the screen, the intersections fail.
>>
>> After much debugging, the problem is that the intersector fails the test 
>> of the intersection of the line with the bounding sphere of my model 
>> geometry
>>
>> Specifically I send up in
>>
>> bool LineSegmentIntersector::intersects(const osg::BoundingSphere& bs)
>>
>>
>> The BoundingSphere is in "model space" , and correct, but the _start and 
>> _end points used in the calculation are incorrect to intersect the sphere 
>> in model space and so the intersection fails.
>>
>> _start {_v=0x000001ba7308d300 {13.227287349450325, -2.9785854231569449, -
>> 5.5167534692525066} }
>> _end {_v=0x000001ba7308d318 {11.072576448741074, -5.1332963238661939, -
>> 7.6714332827528793} }
>>
>> Any ideas what is going on. It seems although the vector of start and end 
>> is the correct vector ( or the "closer" picking would not work), something 
>> is wrong in the transformation into model space.
>>
>> Thx
>> Andrew
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "OpenSceneGraph Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to osg-...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/osg-users/4fa21208-3ee7-45d7-a9cf-42a4b8a45d52%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/osg-users/4fa21208-3ee7-45d7-a9cf-42a4b8a45d52%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> _______________________________________________
>> osg-users mailing list
>> osg-...@lists.openscenegraph.org <javascript:>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/440a9e5d-63e3-40d0-abed-490ca18a311d%40googlegroups.com.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to