Skip to main content

Picking color cubes works - but how to create an object consisting of boxes that is pickable?

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
MoeZarella
Offline
Joined: 2011-07-19

Hi there,

I'm a java3d beginner and managed to create a program which is able to pick colorcubes, boxes and so on. But, I want to create an object that consists of some boxes (for example) and that entire object should be pickable, not the boxes the object consists of. For combining some objects to one object I had a look at the ConeYoYoApp example. In this example the class that combines the cones creates a BranchGroup and adds the cones to it. Afterwards the main programm is getting the branchgroup via a getter method and adds it to the scenegraph. As expected everything is painted correctly.

The problem is that not the object that combines the cones as such is added to the scenegraph, but only the branchgroup. So I can neither set bounds for picking for the object nor make the object pickable.

The question is: How can I create a new object that combines cones, boxes etc (as in the example mentioned above) and can be made pickable? I should also be able to set the bounds (for the pick). Do I have to extend the class shape? In this case I don't see a possibility to add a branchgroup since shape is a leaf, isn't it? Or should I use group to be extended?

Thanks in advance!

Cheers

Nils