I just wanted to create a simple rotation animation...
I thought I could do it myself with the Orient() function but I don't find any function to get the current rotation.
Now here is my code:
- Code: Select all
public void CreatePaketAnimation()
{
int nbFrames = 5;
float totalTime = 1f;
BrumeAnimation Animation = new BrumeAnimation();
Animation.Name = "packet_rotate";
Animation.TotalTime = totalTime;
Animation.AnimatedElements = new BrumeAnimatedElement[1];
Animation.AnimatedElements[0].Name = Animation.Name + " Rotate";
Animation.AnimatedElements[0].RotationKeys = new BrumeRotationKey[nbFrames];
Animation.AnimatedElements[0].RotationKeys[0].Time = 0.0f;
Animation.AnimatedElements[0].RotationKeys[0].Rotation = BrumeQuaternion.RotationAxis(BrumeVector.XAXIS, BrumeAngle.ToRadian(0f));
for (int i = 1; i < nbFrames - 1; i++)
{
Animation.AnimatedElements[0].RotationKeys[i].Time = (float)((totalTime * i) / nbFrames);
Animation.AnimatedElements[0].RotationKeys[i].Rotation = BrumeQuaternion.RotationAxis(BrumeVector.XAXIS, BrumeAngle.ToRadian(360f * i / nbFrames));
}
Animation.AnimatedElements[0].RotationKeys[nbFrames - 1].Time = totalTime;
Animation.AnimatedElements[0].RotationKeys[nbFrames - 1].Rotation = BrumeQuaternion.RotationAxis(BrumeVector.XAXIS, BrumeAngle.ToRadian(360f));
BrumeAnimationManager.AddAnimation(Animation);
}
- Code: Select all
AnimationStates.CurrentTime = 0.0f;
AnimationStates.Speed = 1f;
AnimationStates.Duration = 1f;
Animation = BrumeAnimationManager.GetAnimation("packet_rotate");
AnimationStates.TargetAnimation = Animation;
AnimationStates.CurrentTime = 0.0f;
AnimationStates.PlayMode = BrumeAnimationParams.PLAY_LOOP;
The code is from the IceCube project. There it works.
I've played with the parameters but I didn't see any animation there.
Is there any "start" function I haven't seen?