This last solution worked 100% :)
I have to say thanks to all of you for the help.
Regards
At 10:07 10-10-2003, you wrote:
It sounds like you set the user data on the Box (a Group), but not on=========================================================================== 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".
the Shape3Ds that make up the Box (the faces). You need to recursively
set the user data on all nodes of the Group to ensure that you have it
after a pick.
See the VrmlPickingTest example from my book:
www.manning.com/selman
Sincerely,
Daniel Selman
Dirk L. van Krimpen wrote:
Carlos,
I think you have to cast the node to a Shape3D, as follows:
System.out.println(((Shape3D)node).getUserData());
Hope, it works for you,
Dirk
----- Original Message -----
From: "Carlos Vieira" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 09, 2003 2:24 PM
Subject: [JAVA3D] Another Identify Picked Object Problem :(
Hi all of you, and thanks for your precious help :)System.out.println("-----------------------------");
I tried to make the identification by doing this:
public void mouseClicked(MouseEvent e){
System.out.println("*** Mouse Click ***");
pickCanvas.setShapeLocation(e);
PickResult results = pickCanvas.pickClosest();
//Node node = results.getObject();
if (results != null)
{
System.out.println(results);
//System.out.println(node.getUserData());javax.media.j3d.TransformGroup
}
}
This works very well with the commented lines and print the results
variable like this,
where cuboGeloID is the text that i gave to the box with setUserData. So i
think that
the box has an identifier and it was picked sucessfully:
Print of the results variable after picking:
*** Mouse Click ***
PickResult: sgp:[EMAIL PROTECTED] :
: com.sun.j3d.utils.geometry.Box, cuboGeloID :===========================================================================
javax.media.j3d.Shape3Djavax.medi
[EMAIL PROTECTED]
LocalToVworld Transform:
1.0, 0.0, 0.0, -8.0
0.0, 1.0, 0.0, 4.6
0.0, 0.0, 1.0, -14.5
0.0, 0.0, 0.0, 1.0
node:[EMAIL PROTECTED]
PickIntersection: geomIndex = 0
dist:57.28777659701104
ptVW:(-9.174001979439316, 5.659693372592018, -16.5)
PickIntersection: geomIndex = 0
dist:57.27620679949459
ptVW:(-9.116157611954812, 5.71615761195481, -16.5)
-----------------------------
But if i uncomment the lines in my code to use the getUserData
i get the null from the getUserData :(
Am i doing anything wrong? Can anyone help.
Thanks again
Carlos
To unsubscribe, send email to [EMAIL PROTECTED] and include in thebody
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
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".
===========================================================================
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".