[osg-users] PolytopeIntersector with AutoTransform
Robert Osfield
robert.osfield at gmail.com
Sun Dec 4 04:47:48 PST 2016
Hi Bruno,
The complication with AutoTransform is the it computes it's values
only in the CullVisitor so you'll inherit what ever the last frame
used for it's settings. This should work OK most of the time. If you
have multiple views on the scene this will mean that there are
multiple stats but only the last one will be left in place for the
next frame.
Robert.
On 3 December 2016 at 17:55, Bruno Oliveira
<bruno.manata.oliveira at gmail.com> wrote:
> 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?
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
More information about the osg-users
mailing list