Hi, Im trying to add objects into my scene on some kind of MouseEvent.
I want to click a certain point and have a cube for instance generated.
The java3d tutorial from sun goes through basically every possible
other use for every possibly event but doesnt seem to mention how you
add to the scenegraph in this way!!! Any help would be greatly
appreciated!
> Hi, Im trying to add objects into my scene on some kind of MouseEvent.
> I want to click a certain point and have a cube for instance generated.
> The java3d tutorial from sun goes through basically every possible
> other use for every possibly event but doesnt seem to mention how you
> add to the scenegraph in this way!!! Any help would be greatly
> appreciated!
The main thing you have to remember is that whatever it is you want to add to the live scenegraph, it has to be wrapped in a BranchGroup.
The root branch of your scenegraph should have ALLOW_CHILDREN_WRITE capabilities. It may also need ALLOW_CHILDREN_EXTEND.
Create your Shape3D object (or whatever it is) and make it a child of a BranchGroup. Your PickMouseBehavior can then add the BranchGroup (contains the Shape3D object) to the root branch of your scenegraph.
Paul
Craig D - 12 Nov 2005 04:51 GMT
Hey Paul,
Thanks for the info. Should be exactly what im looking for. Will see
how far i get tomorrow and let you know if i run into any other
problems!!
Thanks,
Craig