Interpolator on a TransformGroup

I’m looping through a model and when I come to a specific TransformGroup I’d like to be able to use an Interpolator to move or rotate the group. Is this possible based on just knowing the TransformGroup?

I’m new to this but I’ve been trying things like the code below. I think the problem is where I’m adding the Interpolator. Where do I need to add the Interpolator?


TransformGroup g = (TransformGroup) o;
g.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
g.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
Transform3D yAxis = new Transform3D();
Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0);
RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, g, yAxis, 0.0f, (float) Math.PI * 2.0f);
rotator.setSchedulingBounds(bounds);
g.addChild(rotator);

Thanks!

DesQuite

That looks ok, but where are you getting that “bounds” object you are passing in to setSchedulingBounds? If that bounds doesn’t hit the view frustum then the behavior won’t start. That may be the problem.

In the HelloUniverse, there is a spinning cube. I would compere you code to that to make sure you got all the connections, wake-ups, and capabilities set right.

The bounds seemed to be the problem. I was using a bounds that was being defined and used elsewhere. I created a new BoundingSphere and used that object. Now it works!

Thanks!

DesQuite