Try BranchGroup instead Node
========= PICKING
===================
BranchGroup shapeClicked = null;
// Get Object Data to determine part
shapeClicked = (BranchGroup) pickResultArray[i].getObject();
Object shapeSelected = shapeClicked.getUserData();
BranchGroup shapeClicked = null;
// Get Object Data to determine part
shapeClicked = (BranchGroup) pickResultArray[i].getObject();
Object shapeSelected = shapeClicked.getUserData();
greetz Martin
----- Original Message -----
From: "P Watson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 03, 2003 11:08 AM
Subject: [JAVA3D] Object
detection
I am wondering if anyone can help me. I have loaded a vrml file into my
Java3D scene, assign a setUserData method to the branchgroup with a
relative
name. I have a separate pick routine that i would like to detect what
object
i have selected by using the getUserData method.
The problem is that i am assigning a name to a branch group and when i
do
the pick i am returned a shape object. I want these objects to be the
same
but i can't find an instruction which will either assign a getUserData
command to shape3D from the vrml loaded file or a pick behaviour which
returns the branchgroup clicked.
file://=========LOADER & ASSIGN =============
// Call VRML Loader with 'TopfileA.wrl'
Scene scene = loadVrmlShape(slocation+fileName);
shapeBG = scene.getSceneGroup(); // get scene branch group
shapeBG.setUserData("StartObj");
file://========= PICKING ===================
Node shapeClicked = null;
// Get Object Data to determine part
shapeClicked = (Node) pickResultArray[i].getObject();
Object shapeSelected = shapeClicked.getUserData();
Paul Watson (Senior Design Consultant)
www.rcid.ncl.ac.uk
Resource Centre for Innovation in Engineering Design
Bruce Building
University of Newcastle Upon Tyne
Newcastle Upon Tyne
NE1 7RU, UK Tel: 0191 222 5306
=========================
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".
