Java3D - picking

S

seatizen

Hello.
My problem is:
I've got two Box objects on the screen. I click one of them (picking):
....
sceneGraphPath = branchGroup.pickClosest(pickRay)
....

How can i find out (using the sceneGraphPath object) which Box did i
clicked?
When i was using ColorCube objects i could do it:
ColorCube cc = (ColorCube)sceneGraphPath.getObject();
and it worked. Now i need to use Box objects and there is an error
(ClassCastException).
Is it possible that pickClosest's result is only one of the sides of the Box
(not whole Box)? - and if so - how can i find out which Box object is it
exactly??
I'll be REALLY greatful for any help.
Greetings
(e-mail address removed)
PS: If you have some basic code (about picking) please send me too.
And sorry
 
M

Matt Humphrey

seatizen said:
Hello.
My problem is:
I've got two Box objects on the screen. I click one of them (picking):
...
sceneGraphPath = branchGroup.pickClosest(pickRay)
...

How can i find out (using the sceneGraphPath object) which Box did i
clicked?
When i was using ColorCube objects i could do it:
ColorCube cc = (ColorCube)sceneGraphPath.getObject();
and it worked. Now i need to use Box objects and there is an error
(ClassCastException).
Is it possible that pickClosest's result is only one of the sides of the Box
(not whole Box)? - and if so - how can i find out which Box object is it
exactly??
I'll be REALLY greatful for any help.
Greetings
(e-mail address removed)
PS: If you have some basic code (about picking) please send me too.
And sorry

Are the Box objects the lowest level nodes? Are they pickable? Are there
other pickable nodes? What is the class of the object being returned? You
can use .getClass ().getName () to find out. It's possible that it's just
an unexpected object in the scene graph because pickClosest will find an
object--and your intuition may be right that a component of Box is being
picked.

Cheers,
Matt Humphrey (e-mail address removed) http://www.iviz.com/
 
S

seatizen

U¿ytkownik "Matt Humphrey said:
Are the Box objects the lowest level nodes? Are they pickable? Are there
other pickable nodes? What is the class of the object being returned? You
can use .getClass ().getName () to find out. It's possible that it's just
an unexpected object in the scene graph because pickClosest will find an
object--and your intuition may be right that a component of Box is being
picked.

Cheers,
Matt Humphrey (e-mail address removed) http://www.iviz.com/

There are only two Boxes, so it's rather impossible, that i picked another
object. I'm really "fresh" Java user, so i'm not sure if i understand your
question properly. But let's try:)
Simplified scheme:
Box2
|
BG-->TG1-->TG2-->Box1

What did you mean asking if they were pickable? (when i used ColorCube i had
no problem, and now i changed only ColorCubes for Boxes).
The class of returned object is Shape3D (shouldn't it be just Box?).
Greetings
(e-mail address removed)
 
Joined
Jul 28, 2012
Messages
1
Reaction score
0
stuck with the same problem

Hey mate, did u get any solution for that,
I am building a java3d GUI, using which users can create custom scene graphs, without needing to know the code, i want to pick specific boxes using mouse, and i want to be able to move them around.. so for that i need picking..
let me know if u get the answer :)
cheers, m also lookin into it. !!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top