title: Problem with removeChild() function
body: <p>I want to delete a child form a <a href="http://download.oracle.com/docs/cd/E17802_01/j2se/javase/technologies/desktop/java3d/forDevelopers/J3D_1_3_API/j3dapi/javax/media/j3d/BranchGroup.html" rel="nofollow"><code>BranchGroup</code></a>
  and use the function <code>removeChild()</code>, but an exception occurred. 
  This is my a part of my code; root is an branchgroup.</p>
  
  <blockquote>
    <p>//root is a branchgroup</p>
  </blockquote>
  
  <pre><code>public BranchGroup Creat()
  {
      td.setTranslation(new Vector3d(.5f,.5f,.5f));
  
  
      tg.setTransform(td);
      tg.addChild(cube);
  
      td1.setTranslation(new Vector3d(x, y, z));
      tg1.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
      tg1.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
      collision ob = new collision(cube,bounds);
      collision ob1 = new collision(cube1, bounds);
      root.addChild(ob1);  
      cube.setUserData(new String("cube"));
      tg1.setTransform(td1);
      tg1.addChild(cube1);
      root.addChild(tg);       
      root.addChild(tg1);
      //root.addChild(new ColorCube(.03));
  
      return root;
  }
  
  public void delete(int x)
  {        
      root.removeChild(x);
  }
  </code></pre>
  
  <p>this is it's exception</p>
  
  <pre><code>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:217)
      at td44.Draw.delete(Draw.java:95)
      at td44.Draw$collision.Remove(Draw.java:240)
      at td44.Draw$collision.processStimulus(Draw.java:216)
      at javax.media.j3d.BehaviorScheduler.doWork(BehaviorScheduler.java:192)
      at javax.media.j3d.J3dThread.run(J3dThread.java:275)
  </code></pre>
  
  <p>delete() function is used in another class</p>