Hello,
My solution to identifying a Picked transform was to store all of my
transformgroups in an array of my own class. Then I had my Pick behavior
call a method in the main to cycle through all the instances and compare the
picked transform to each instances transform. I did this with simply an if
statement.
An additional modification to the Pick Behavior code was to have it take a
pointer to my mains class. That way I could call a method within the main
from the PickBehavior.
Here's the modified PickRotateBehavior. sjmTransformGroup is just an
extension of TransformGroup. my_sjmLoad is the instance of the main that
was passed to the pick behavior:
//this is towards the end of the code:
// Make sure the selection exists and is movable.
if ((tg != null) &&
(tg.getCapability(TransformGroup.ALLOW_TRANSFORM_READ)) &&
(tg.getCapability(TransformGroup.ALLOW_TRANSFORM_WRITE))){
drag.setTransformGroup(tg);
drag.wakeup();
//THE NEXT LINE CALLS THE METHOD TO COMPARE TRANSFORMGROUPS
currentTG =
tg;my_sjmLoad.isObjectChanged((sjmTransformGroup)tg);
} else if (callback!=null)
callback.transformChanged( PickingCallback.NO_PICK, null );
}
//more code followed.
Sean
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Arvi Chahal
> Sent: Thursday, February 18, 1999 3:55 PM
> To: Java3D
> Subject: [java3d] Picking!
>
>
> I have pick behaviors defined on each object that makes up my scene. Each
> object is in its own TransformGroup. So if I click the mouse on an object
> then I can manipulate it.
>
> How do I find out which object I am currently manipulating. E.g.
> if i had an
> object contained in the transformgroup object2, then if i click with the
> mouse on object2 in the scene, I would like to retrieve the name
> object2 in
> string form so i can print it out using System.out.println.
>
> So how can i retrieve the names of the transformgroups i am currently
> manipulating/picking with the mouse?
>
> Thanks.
>
> ************************************************
> Arvi Chahal
> [EMAIL PROTECTED]
> ************************************************
>
> =====================================================================
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 3D Home Page: http://java.sun.com/products/java-media/3D/
>
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/