Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

rotating a cube around the X- and the Y-Axis

843799Dec 15 2008 — edited Dec 29 2008
I am trying to rotate around the X-Axis and the Y-Axis, but the cube is only rotating around one of them.
Here's my code:
	TransformGroup objSpin = new TransformGroup();
	objSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
                BranchGroup branchgroup = new BranchGroup();
                branchgroup.addChild(transroot);
	transroot.addChild(objSpin);
	objSpin.addChild(new ColorCube(0.12));
	Transform3D yAxis = new Transform3D();
	yAxis.rotY(Math.PI/2.0);
	Transform3D xAxis = new Transform3D();
	xAxis.rotX(Math.PI/2.0);
	Alpha rotationAlpha = new Alpha(-1, 7000);
	Alpha rotationAlphaa = new Alpha(-1, 7000);
	RotationInterpolator rotator =
	    new RotationInterpolator(rotationAlpha, objSpin, yAxis,
				     0.0f, (float) Math.PI*2.0f);
	RotationInterpolator rotatora =
	    new RotationInterpolator(rotationAlphaa, objSpin, xAxis,
				     0.0f, (float) Math.PI*2.0f);
	BoundingSphere bounds = new BoundingSphere();
	BoundingSphere boundsa = new BoundingSphere();
	rotator.setSchedulingBounds(bounds);
	rotatora.setSchedulingBounds(bounds);
	objSpin.addChild(rotator);
	objSpin.addChild(rotatora);
What do I have to do to combine the two RotationInterpolators?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 26 2009
Added on Dec 15 2008
1 comment
164 views