Transforming after a Branch Group has been created
This is probably very straight forward, but I'm just getting started so don't laugh at me.
I have a method to create a box which works fine, but after it has been created I want to (among other things) translate it. Unfortunately I have no ideas how to do this, although I have attempted it and failed. Could anybody tell me how to fix this code? The cube just stays put.
Cheers,
Dodge
private SimpleUniverse universe =new SimpleUniverse();
private BranchGroup boxGroup;
publicvoid createBox(){
boxGroup =new BranchGroup();
boxGroup.setCapability(BranchGroup.ALLOW_DETACH);
Box box =new Box();
// I think this (below) may be a bit unnecessary really,
// but I'd like to assume the box may have been
// manipulated by something else before applying the
// translation.
TransformGroup tg =new TransformGroup();
boxGroup.addChild(tg);
tg.addChild(box);
tg.addChild(lightsPlease());
universe.addBranchGraph(boxGroup);
}
publicvoid translateBoxGroup(){
boxGroup.detach();
TransformGroup tg =new TransformGroup();
Transform3D t =new Transform3D();
t.setTranslation(new Vector3f(2f, 0f, 0f));
tg.setTransform(t);
b.addChild(tg);
universe.addBranchGraph(boxGroup);
}

