[osg-users] PolytopeIntersector with AutoTransform

Bruno Oliveira bruno.manata.oliveira at gmail.com
Sat Dec 3 09:55:48 PST 2016


Hello,

in my scene graph I'm using an AutoTransform to add a circle with
Radius=10, centered on (0,0,0):

  float Radius = 10;
  for (int i = 0; i < nPointsInCircle; i++)
    vertArray[i] = Vec3d( radius * sin(...), radius* cos(...), 0.));

then I add this to a Drawable + Geode, and add that Geode to an
AutoTransform:

  auto* autoTransform = new osg::AutoTransform;
  autoTransform->addChild(circleGeode);
  autoTransform->setAutoScaleToScreen(true);
  autoTransform->setPosition(100, 100, 0);

This results in a circle located in (100, 100, 0), with radius 10, scaling
automatically to screen. VISUALLY this is what I want.
Now when I use a PolytopeIntersector on this node, it returns intersection
coordinates of the circle , in the Circle's geometry frame, centered in
(0,0,0) with radius 10. This means that, if I hover my mouse over the
Circle, which is located in world coordinates in (100, 100, 0), the
PolytopeIntersector returns coordinates centered in (0,0,0) with maximum
radius 10.


How can I obtain true world coordinates with Autotransforms?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20161203/cf968e81/attachment-0002.htm>


More information about the osg-users mailing list