- Home /
Animation rotate with Ani.Mate
Hi, I'm using AniMate in C# to do some animation in script. I only have some problems with rotation. This is what I did:
Hashtable props = new Hashtable();
props.Add("position", new Vector3(0, 0, 0));
props.Add("rotation", Quaternion.Euler(30, 0, 0)); //dispatches an error
props.Add("easing", typeof(Ani.Easing.Quadratic));
props.Add("direction", Ani.Easing.InOut);
Ani.Mate.To(transform, 1, props);
When I execute this I get the following error:
Ani.Mate.Error: Cannot animate UnityEngine.Quaternion with target UnityEngine.Quaternion: Operation +, - or * not supported. (System.MissingMethodException: Method not found: 'UnityEngine.Quaternion.op_Subtraction'. ...
Does anyone know what is going wrong here?
BTW I'm using AniMate version 2.0.
I'm very frustrated with this problem, too. Whatever I try to pass as a rotation value, I don't get it working.
Nobody using rotation in c# with Ani$$anonymous$$ate around here ?
Answer by Henk Jan Baard · Mar 25, 2010 at 07:21 AM
I figured out what the problem was. I did not add the 'drive' property and apparently this is mandatory.
props.Add("drive", typeof(Ani.Drive.Slerp));
So the code should look like this:
Hashtable props = new Hashtable();
props.Add("position", new Vector3(0, 0, 0));
props.Add("rotation", Quaternion.Euler(30, 0, 0)); //dispatches an error
props.Add("easing", typeof(Ani.Easing.Quadratic));
props.Add("direction", Ani.Easing.InOut);
props.Add("drive", typeof(Ani.Drive.Slerp));
Ani.Mate.To(transform, 1, props);
Answer by qJake · Mar 24, 2010 at 08:16 AM
From the link you posted, read the section on "Special Cases > Animating Rotation". You aren't using the Rotation component with "To" properly.
http://www.unifycommunity.com/wiki/index.php?title=AniMate#Animating_Rotation
I am using the To property but did not add the 'drive' property. (See my answer)
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Update iTween Path at Runtime 1 Answer
2d animation import 1 Answer
Animation On Button Press 3 Answers
Animation by Scripting point A to B 1 Answer