Hello all,

 

I'm having a little trouble wrapping my head around getting AutoTransform
and Draggers to play together so I thought I'd turn to the trusty mailing
list.

 

What I'm trying to do:

1)      Populate a scene with many things.  One of which is an object -
let's assume it's a sphere for simplicity.

2)      I want the sphere to translate according to world coordinates but as
far as scaling I want it to stay in model/screen coordinates.  In other
words the sphere moves around but never changes size.

3)      I want to be able to move the sphere around with the mouse in a 2D
plane.

 

What I've done:

I'm close to a solution.  I can use the AutoTransform to accomplish (2) by
setting setAutoScaleToScreen(true) and that works fine by itself (w/o using
a dragger).  I can use a dragger (TranslatePlaneDragger) to accomplish (3)
and that works fine by itself (w/o using autotransform) but the problem is
that the sphere scales with the world/scene which I don't want.

 

Now for trying to combine them:

I've thought of at least 3 options (actually more) for what the scene graph
should look like which follow.

 

Option 1:

[Root]

[Transform node (local to world)]

[AutoTransform node]

[Group node]

[Selection node] [Dragger node]

 

And under [Selection node]:

[mySphereGeode node]

 

And under [Dragger node]:

[_translate2DDragger (which is the default TranslatePlaneDragger geom geode)
node]

 

Option 2:

[Root]

[Transform node (local to world)]

[Group node]

[Selection node] [Dragger node]

 

And under [Selection node]:

[AutoTransform node]

[mySphereGeode node]

 

And under [Dragger node]:

[_translate2DDragger (which is the default TranslatePlaneDragger geom geode)
node]

 

Option 3:

[Root]

[Transform node (local to world)]

[Group node]

[Selection node] [Dragger node]

 

And under [Selection node]:

[AutoTransform1 node]

[mySphereGeode node]

 

And under [Dragger node]:

[AutoTransform2 node]

[_translate2DDragger (which is the default TranslatePlaneDragger geom geode)
node]

 

Conceptually Options 1 and 2 don't seem right to me.  I've tried them
anyway-option 1 seems like it works until you move the camera and things go
screwy.  I think it's because the translations as a result of the dragger
are magnified/scaled by the autotransform node above it.  Option 2 works but
leaves the dragger polygon in world coordinates which isn't what I want.

 

Option 3 seems like the right choice to me but I can't get it to work
correctly.  The dragger polygon doesn't show up...  Anyone have any
insight??  I can provide more info for clarification and/or code snippets if
anyone needs.

 

Thanks

-Brad

 

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to