I have an object type which extends BranchGroup. Something like shown below.
public class Model extends BranchGroup {
Shape3D shape;
public Model(){
addChild(shape);
}
}
I want to be able to translate this object around on the screen. I thought I would be able to use setTransformGroup to do this.
Model myModel = new Model();
translateGroup = new TransformGroup();
Transform3D translate = new Transform3D();
translate.setTranslation(new Vector3f(10,10,0));
translateGroup.setTransform(translate);
myModel.setTransformGroup(myTransform);
addChild(myModel);
But this doesn’t seem to be working. Am I using the setTransformGroup incorrectly?
If this is totally wrong then the other way I was thinking was to put in my Model class a TransformGroup for translating. Something like …
public class Model extends BranchGroup {
Shape3D shape;
public Model(){
addChild(TranslateGroup);
TranslateGroup.addChild(shape);
}
}
Do you think this would work? THanks for any advice.
~Shochu