The "javax.media.j3d.TransformGroup@" part tells you what type of object it
is, the part after is the identity.

In order to do what you want, you have to create a seperate data structure
to hold some reference to your objects.

I used a Java vector type to hold a list of my classes of objects that I
add in the scene.  Each of my classes has references to the top level
BranchGroup and TransformGroup for the object.

You then need to enumerate through your list and compare the TransformGroup
that the methods in the callback have with the ones in your list.

So for example, in the callback method transformChanged() I have a method
called SetCurrentStarFromTransformGroup() and it takes the tg of this
method and enumerates through the vector which lists all my classes and
since each of my class objects has a reference to the TransformGroup of the
object, I can compare them and when I find a match, it sets the currently
selected object to be the one I clicked on.

public void transformChanged(int type, TransformGroup tg)
{
         if ((tg != null) )
         {
                 SetCurrentStarFromTransformGroup(tg);
         }
}


I don't know of a better way of doing it.  You really need to think it through.

Good Luck




At 09:39 PM 01/13/2001 +0100, you wrote:
>Dear Eric
>
>Yes the problems U pointed out were totally valid and once i fixed them up
>the program works fine and only responds when one clicks on the pickable
>objects.
>now i want that every object has its own unique info which i want to print
>in a dialog box. For this i need to check  for its unique identity either
>thru its geometry or Transform3D (Creating a separate TG is probably not the
>right approach, since it might be heavy in computation)
>
>When i try to print the TransformGroup tg in the transformDoubleClicked
>method the system prints code like:
>javax.media.j3d.TransformGroup@e1801a98
>javax.media.j3d.TransformGroup@e9981a98
>javax.media.j3d.TransformGroup@68a41a99
>i dont know how to identify the object with its unique identity.
>I tried by setting the SceneGraphPath and then using the getObject() method
>to get the node but doesn't help.
>
>Can u suggest me which way i can create Text2D objects and identify each
>separately , such that every time transformDoubleClicked is called it can
>check for this unique identity and accordingly print the right info.
>
>Thanks so much for your valueable help.
>Richie

***********************************************************************
Eric Reiss
Manager MEMS Lab
Swanson New Product Incubator
School of Engineering  - University of Pittsburgh

3700 O'Hara Street
647 Benedum Hall
Pittsburgh, PA 15261
Phone: 412-624-9696
Email: [EMAIL PROTECTED]
http://www.sigda.acm.org/Eric/
***********************************************************************

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to