Java3D - picking

Discussion in 'Java' started by seatizen, Feb 7, 2004.

  1. seatizen

    seatizen Guest

    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

    PS: If you have some basic code (about picking) please send me too.
    And sorry
     
    seatizen, Feb 7, 2004
    #1
    1. Advertising

  2. Andrew Thompson, Feb 7, 2004
    #2
    1. Advertising

  3. "seatizen" <> wrote in message
    news:c039c2$7gm$...
    > 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
    >
    > 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 http://www.iviz.com/
     
    Matt Humphrey, Feb 7, 2004
    #3
  4. seatizen

    seatizen Guest

    U¿ytkownik "Matt Humphrey" <> napisa³ w wiadomo¶ci
    news:...
    >
    > "seatizen" <> wrote in message
    > news:c039c2$7gm$...
    > > 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
    > >
    > > 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 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
     
    seatizen, Feb 8, 2004
    #4
  5. seatizen

    x2am

    Joined:
    Jul 28, 2012
    Messages:
    1
    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. !!
     
    x2am, Jul 28, 2012
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Richard Ivarson

    Re: Java3d game development

    Richard Ivarson, Jul 10, 2003, in forum: Java
    Replies:
    0
    Views:
    2,323
    Richard Ivarson
    Jul 10, 2003
  2. Hoagie
    Replies:
    5
    Views:
    793
    Harald Hein
    Oct 15, 2003
  3. Hoagie
    Replies:
    1
    Views:
    571
  4. P. Flavin
    Replies:
    0
    Views:
    6,406
    P. Flavin
    Oct 17, 2003
  5. Sheena
    Replies:
    1
    Views:
    399
    Harald Hein
    Oct 28, 2003
Loading...

Share This Page