Hello,

I am just getting started with Java3D, so I am just trying to do some simple
things with the help of the utility classes (while reading Sun's tutorial),
but I quickly got stuck.

What I tried to do was to rotate two cubes, but I wanted to apply a simple
translation to one of them so that they wouldn't be in the exact same spot.
This translation works as long as I don't rotate the cube, but as soon as I
rotate it it seems to move back to it's original position (0,0,0).

The following code builds the scene graph. I'd appreciate any pointers as to
what I am missing.

Thanks!

BranchGroup objRoot = new BranchGroup();

TransformGroup objSpin1 = new TransformGroup();
objSpin1.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objRoot.addChild(objSpin1);
objSpin1.addChild(new ColorCube(0.1));

Transform3D translate2 = new Transform3D();
Vector3f vector2 = new Vector3f(0.0f, 0.5f, 0.0f);
translate2.setTranslation(vector2);

TransformGroup objSpin2 = new TransformGroup(translate2);
objSpin2.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objRoot.addChild(objSpin2);
objSpin2.addChild(new ColorCube(0.1));

Alpha rotationAlpha = new Alpha(-1, 4000);
RotationInterpolator rotator1 =
        new RotationInterpolator(rotationAlpha, objSpin1);
RotationInterpolator rotator2 =
        new RotationInterpolator(rotationAlpha, objSpin2);

BoundingSphere bounds = new BoundingSphere();
rotator1.setSchedulingBounds(bounds);
rotator2.setSchedulingBounds(bounds);
objSpin1.addChild(rotator1);
objSpin2.addChild(rotator2);

--
/ Peter Schuller, InfiDyne Technologies HB

PGP userID: 0x5584BD98 or 'Peter Schuller <[EMAIL PROTECTED]>'
Key retrival: Send an E-Mail to [EMAIL PROTECTED]
E-Mail: [EMAIL PROTECTED] Web: http://scode.infidyne.com

===========================================================================
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