Hello,


If I understand you right, you want to be able to "pick" individual
transforms within a Scenegraph and manipulate them by rotation, translation,
and zoom.

The way I achieved this was extracting the code for PickRotateBehavior.java,
PickTranslationBehavior.java, and PickZoomBehavior.java from the source
"jar" file that came with Java3D.  I tailored them to my needs and compiled
them directly in the folder where my application was.

I realized that PickRotate and the others actually use MouseRotateBehavior.
So, I didn't use MouseRotateBehavior in my code, just pick rotate, etc..
When I created the instance of the Pick Behaviors, I passed them my outer
most TransformGroup (my Scene scaling group) and the "this" of my
application..

I revamped my Pick code to take the passed transform group and application's
"this".  In the part of the code where it shoots out a ray or something and
finds a transform group, I made it only pick one if the "shift" key was
done; otherwise, it would assume to use the passed outer most
transformgroup.  The effect of that is the same as using just a
MouseBehavior on the scene.

One other thing, I had to pass the "this" of my application so that the Pick
behavior could get the display.  In the code, you'll see (sjmLoad).  That's
just my application I was passing.

In my createSceneGraph routine, the Picks were set up as follows:

PickRotateBehavior behavior4 = new PickRotateBehavior(objRoot, objScale,
sjmLoad.this, bounds,
                                                         PickObject.USE_GEOMETRY);

objRoot=the outermost BranchGroup
objScale=the TransformGroup attached to objRoot
sjmLoad.this=pointer to my application which is an extension of a Frame
bounds=the bounds

Attached is the revamped PickRotateBehavior.

Good luck,
Sean





PickRotateBehavior.java

Reply via email to