We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Animation with Rotation

Hello,

I wanted to know if there is a way where i can add an animation to a node, where let’s say a cube rotates around its own axis?

Thanks in advance :slight_smile:

Hi,

I believe that this article might be useful for you.


I hope it helps.

Hey @mlyra, thanks for the link! I already checked it out and tried it out, but this is just a translation (at least the first one). I was wondering, if there can also be a rotation added to the animation, let’s say a cube. Not just the camera.

@Hue404

It is possible to add an animation to a node, but only FBX supports animation now.

 private static void RotatingCube()
        {
            Scene scene = new Scene();
            //create a cube and node for animating
            var cube = new Box();
            var cubeNode = scene.RootNode.CreateChildNode(cube);
            //create a new animation clip and animation node
            var animationClip = scene.CreateAnimationClip("rotatingCube");
            var animationNode = animationClip.CreateAnimationNode("rotatingCube");

            //the animation will be bound to EulerAngles property of cubeNode.Transform object
            var bindPoint = animationNode.CreateBindPoint(cubeNode.Transform, "EulerAngles");
            //the keyframe will be bound to the X component of the EulerAngles
            var keyframeSequence = bindPoint.CreateKeyframeSequence("X");

            //the keyframe sequence definition
            keyframeSequence.Add(0, 0.0f);
            keyframeSequence.Add(2, 90.0f);
            keyframeSequence.Add(4, 180.0f);
            keyframeSequence.Add(6, 90.0f);
            keyframeSequence.Add(8, 00.0f);

            scene.Save("RotatingCube.fbx");
        }
1 Like

thanks a lot!! This did the job :smiley:

1 Like