Skip to main content

animation of one dimension of a box

1 reply [Last post]
banka
Offline
Joined: 2006-02-24
Points: 0

Hi,
Excuse me for my poor English, I try the best I can :)

I'm just begining with Java3D for a few days.

I have to anim the height of a Box, from 1.0 (100%) to a value I stored in a var. I'm able to change uniformly the height, width and depth of the box with a ScaleInterpolator, but not just the height of it, even with a setScale(vector3d) on the Transform3D I set in my TransformGroup.

Without any animation, it works fine. it's strange.

It'd be nice if someone could help me.

Cedric

Message was edited by: banka

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
banka
Offline
Joined: 2006-02-24
Points: 0

I tried that way :
[code]Transform3D anim = new Transform3D();
anim.setScale(new Vector3d(1, 3, 1));
TransformGroup animGroup = new TransformGroup(anim);
animGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Alpha myAlpha = new Alpha(1, 5000);
ScaleInterpolator interpol = new ScaleInterpolator(myAlpha, animGroup);
BoundingSphere bounds = new BoundingSphere();
interpol.setSchedulingBounds(bounds);
animGroup.addChild(interpol);
this.box = new Box(width, height, depth, Box.GENERATE_NORMALS, appearance);
animGroup.addChild(this.box);
this.addChild(animGroup);[/code]

and that way :
[code]Transform3D anim = new Transform3D();
anim.setScale(new Vector3d(1, 3, 1));
TransformGroup animGroup = new TransformGroup(anim);
animGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Alpha myAlpha = new Alpha(1, 5000);
ScaleInterpolator interpol = new [b]ScaleInterpolator(myAlpha, animGroup, anim, 1, 3);[/b]
BoundingSphere bounds = new BoundingSphere();
interpol.setSchedulingBounds(bounds);
animGroup.addChild(interpol);
this.box = new Box(width, height, depth, Box.GENERATE_NORMALS, appearance);
animGroup.addChild(this.box);
this.addChild(animGroup);[/code]

Do you think that what I want is possible with a [i]ScaleInterpolator[/i]. Defining a scale vector with the value 1 on the X and Z axis, and 3 on the Y axis doesn't seems to work. I thought this vector defines de way the [i]ScaleInterpolator[/i] behaves, but it was obviously wrong.

Message was edited by: banka