Allistair,
One
way to do it would be to assign an Id to each parent TransformGroup using
setUserData. You can then retrieve the parent of the picked Shape3D (the Box
group) using getParent. Call getParent *again* to get the TG, then call
getUserData and you should get your Id.
Otherwise you could iterate over the Box Shape3D's after it is created
and assign the Id (setUserData) to each - that way you don't have to fudge
around with the calls to getParent and your code might be more
general.
Sincerely,
Daniel
Selman
Dear All,
I am really puzzled by a problem and would
appreciate it if anyone could offer any help with it.
I create a TransformGroup as shown below
and add a series of child TransformGroups each of which has a Box Primitive
as their child.
TG
||
//
\\
TG TG
.....
|| ||
Box Box
I have used PickHighlightBehavior so that each
Box on the rendered screen can be chosen and highlighted.
Now the logic of my program is such that each
Box needs a unique ID. I wish to be able to retrieve that unique ID (just an
integer) when the user picks it.
PickHighlightBehavior only retrieves the
Shape3D that was picked and since the Box class consists of 6 Shape3Ds
comprising each face of the Box, I cannot create a hashtable of Shape3D
Boxes to unique ids and then do a match on the picked with the
hashtable.
I have also tried extending both the Box and
Appearance classes to store this id but to no avail.
Help kindly appeciated,
Best Regards,
Allistair
Crossley
|