This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 31st, when you will be able to use this site as normal.

    Forum Stats

  • 3,890,899 Users
  • 2,269,649 Discussions
  • 7,916,821 Comments

Discussions

adding BranchGroup after compile() : live objects

843799
843799 Member Posts: 49,999
edited Jan 4, 2002 5:24PM in Java 3D
hi.

after compile() my objRoot (BranchGroup), i detached some children and attached new ones with picking. but when i try to pick the new child object, i got these error messages.

Exception occurred during Behavior execution:
java.lang.IllegalStateException: Picking can only work if BranchGroup is alive
at javax.media.j3d.BranchGroup.pickClosest


the code is as follows.

class MyClass ...
{
SimpleUniverse su;
su = ...;
public void createBranchGroup()
{
...
...
objRoot.addChild(new myBranchGroup(su));
}
}

class myBranchGroup extends BranchGroup(SimpleUniverse su)
{
.....
TransformGroup trans = new TransformGroup();

PickTranslateBehavior pick = new PickTranslateBehavior(this, new Canvas3D (SimpleUniverse.getPreferredConfiguration()), new BoundingBox() );
this.addChild(pick);
}


i setup needed capability bits (CHILDREN_READ, CHILDREN_WRITE, ENABLE_PICK_REPORTING, etc). but this code generate the error before. how can i add a child with picking? or how can i add a child that is alive?

Comments

This discussion has been closed.