> Hi...
> 
> I am trying to apply the method getShape(int partID) of the Box class.
> 
> I have defined like the following :
> .......
> 
> Box contactor = new Box(1.0f, 0.5f, 0.3f, cupAppear);
> Shape3D contShape = contactor.getShape(Box.LEFT);
> Shape3D contShape1 = contactor.getShape(Box.RIGHT);
> 
> TransformGroup tgContBox = new TransformGroup();
> tgContBox.addChild(contShape);
> tgContBox.addChild(contShape1);
> ...........
> 
> I could not execute my class file. There was the message telling that
> the child has more than one parent.
> 
> I don't understand, because I have created different Shape3D object for
> each part of the contactor object. 
> 
> May be you can tell the error of my program.
> 
> Thank's a lot.......
> 
> Alita

The Shape3D nodes do already have a parent, the Box, because
you didn't create any 'new' Shape3D objects, you just retreived the
Shape3D objects that are already a part of the the Box...

If you want to explicitly add the parts of the box to a TG
you will have to copy them i guess...

But why don't you just add the Box ?, if you'd like to do some
tricks with it's parts you could simply extend the standard Box class
to a custom MyBox class...

Alex...

=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to