but how can I make it visible after detaching the branchgroup.
as you can see in my code extract, I tried it with detach and it worked but I want to 
show it again when things collide. which method is like the inverse od detach?

Ralf

>Yes it is possible, just treat it like a BranchGroup.
>
>Zak
>----- Original Message -----
>From: "Ralf Bednarz" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Friday, July 25, 2003 3:33 PM
>Subject: [JAVA3D] add and remove a platformgeometry
>
>
>> hi
>>
>> isn't is possible to remove a platformGeometry and add it again?
>> I tried to manage it with a TransformGroup and a BranchGroup, but none of
>them worked.
>>
>> pg = new PlatformGeometry();
>>         pg.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
>>         pg.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
>>
>> transF = new TransformGroup();
>>
>> branch = new BranchGroup();
>>                         branch.setCapability(BranchGroup.ALLOW_DETACH);
>>
>> Transform3D tr = new Transform3D();
>>  tr.setTranslation(new Vector3f(0.5f,0.5f,-3.0f));
>>  transF.setTransform(tr);
>>
>> viewCube = new ColorCube(0.1f);
>> transF.addChild(viewCube);
>>
>> branch.addChild(transF);
>> pg.addChild(branch);
>>
>> viewingPlatform.setPlatformGeometry(pg);
>>
>> ..
>>
>> now I have the following methods
>>
>> public void removePlatformObject()
>> {
>>         //branch.detach();      /* this will work */
>>         branch.removeChild(0);   /* this results in the exception below */
>> }
>>
>> public void addPlatformObject()
>> {
>>                 branch.addChild(viewCube);    /* this results in the
>exception below */
>> }
>>
>> Now i want to remove the object when two objects collide, but only the
>"detach version" runs well
>>
>>
>> Exception occurred during Behavior execution:
>> javax.media.j3d.RestrictedAccessException: Group: only a BranchGroup node
>may be removed
>>         at javax.media.j3d.Group.removeChild(Group.java:190)
>>         at java3d.ObjLoad.removePlatformObject(ObjLoad.java:292)
>>         at
>java3d.CollisionDetector.processStimulus(CollisionDetector.java:46)
>>         at
>javax.media.j3d.BehaviorScheduler.doWork(BehaviorScheduler.java:167)
>>         at javax.media.j3d.J3dThread.run(J3dThread.java:256)
>>
>> This should take over a graphic representation of a collision detection
>(in a really plain way)
>> The ColorCube should bereplaced by a short text in future versions
>>
>>
>> thanks for help
>> Ralf
>>
>>
>===========================================================================
>> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
>> of the message "signoff JAVA3D-INTEREST".  For general help, send email to
>> [EMAIL PROTECTED] and include in the body of the message "help".
>>
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JAVA3D-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to