Title: Help

Silvano,

 

Here's some sample code for what Carolina has suggested you. You cannot remove anything in a live scene from TransformGroup until you detach the parent BranchGroup of the TranformGroup. Remove the children and attach the BranchGroup back to the scene.

 

����� BranchGroup bg = new BranchGroup();

����� TransformGroup tg = new TransformGroup();

����� BranchGroup objRoot = new BranchGroup();

 

����� objRoot.setCapability( BranchGroup.ALLOW_CHILDREN_READ );

����� objRoot.setCapability( BranchGroup.ALLOW_CHILDREN_WRITE );

����� objRoot.setCapability( BranchGroup.ALLOW_CHILDREN_EXTEND );

 

����� bg.setCapability( BranchGroup.ALLOW_DETACH );

����� bg.setCapability( BranchGroup.ALLOW_CHILDREN_READ );

����� bg.setCapability( BranchGroup.ALLOW_CHILDREN_WRITE );

 

����� tg.setCapability( TransformGroup.ALLOW_CHILDREN_READ );

����� tg.setCapability( TransformGroup.ALLOW_CHILDREN_WRITE );

 

����� for (int i=0; i<10; i++)����� {

����� ����� BranchGroup b = new BranchGroup();

����� ����� b.setCapability( BranchGroup.ALLOW_DETACH );

����� ����� tg.insertChild( b, i );

����� }

 

����� bg.addChild( tg );

 

����� objRoot.addChild( bg );

 

 

later on when u need to remove the BranchGroup from the transform group

 

����� bg.detach();

����� tg.removeChild( 0 );

����� objRoot.addChild( bg );

 

 

if you have further questions please ask...

 

Ahmed

 

-----Original Message-----
From: Carolina Prieto Mu�iz [mailto:[EMAIL PROTECTED]]
Sent
:
Thursday, September 13, 2001 11:51 PM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] [Java3D]question

 

I believe you have to do this:

 

1. Make the world dead --> remove Branch Graph from Locale

2. Remove every branchgroup children, from end to first because they shift when removed --> you can use removeChild method to do this : branchgroupname.removeChild(child number)

3. Make the world alive again

 

But keep in your mind I am a newbie, if anybody suggest any other way or think this is not right I'll be please to be corrected.

Hope this gives you a hint for starting. good luck.

 

Carolina

----- Mensaje original -----

De: silvano

Enviado: jueves, 13 de septiembre de 2001 18:37

Asunto: [JAVA3D] [Java3D]question

 

 

 

I am using a BranchGroup to add child into a TransformGroup

 

 

ex:

 

TransformGroup tg = TransformGroup();

BranchGroup b;

 

for (i=0; i<cont; i++)

{

 

    b=new BranchGroup();

 

    tg.insertChild( b , i );

}

 

but I can�t remove the childrens after!

 

How I make this??

 

 

Thanks a lot!

   

Reply via email to