public static void TestRotateBy() { Quaternion quatStart = Quaternion.Euler(10.0f, 20.0f, 30.0f); Quaternion quatOffset = Quaternion.Euler(30.0f, 20.0f, 10.0f); Quaternion quatVal = quatStart; Ref <Quaternion> quatRef = new Ref <Quaternion>( () => quatVal, t => quatVal = t ); CommandQueue queue = new CommandQueue(); queue.Enqueue( Cmd.Repeat(2, Cmd.RotateBy(quatRef, quatOffset, 1.0) ) ); queue.Update(0.5f); AreEqual(quatVal, Quaternion.Slerp(quatStart, quatStart * quatOffset, 0.5f), 0.000001f); quatVal = Quaternion.identity; queue.Update(0.5f); AreEqual(quatVal, Quaternion.Slerp(Quaternion.identity, quatOffset, 0.5f), 0.000001f); queue.Update(0.5f); AreEqual(quatVal, quatOffset, 0.001f); queue.Update(0.5f); AreEqual(quatVal, quatOffset * Quaternion.Slerp(Quaternion.identity, quatOffset, 0.5f), 0.000001f); queue = new CommandQueue(); // Make sure the rotation ends in the correct position when given a complex easing function. quatVal = Quaternion.identity; queue.Enqueue( Cmd.RotateBy(quatRef, quatOffset, 1f, Ease.OutElastic()) ); while (!queue.Update(1 / 30f)) { } AreEqual(quatVal, quatOffset, 0.001f); }