static void AngleAxisRaw(Vector3 origin, float angle, Vector3 axis, Quaternion startRotation, BaseVectorDirection builtinDirection, float halfAxisLenght, Vector3 direction, bool showVectorLabel = !default(bool)) { Color temp = Gizmos.color; direction.Normalize(); Gizmos.color = new Color32(162, 0, 255, 255); Gizmos.DrawRay(origin - axis.normalized * halfAxisLenght, axis.normalized * halfAxisLenght * 2); GizmosForVector.DrawVector(origin - axis.normalized * halfAxisLenght, axis.normalized, halfAxisLenght * 2, Gizmos.color); Quaternion endRotation = Quaternion.AngleAxis(angle, axis); endRotation = endRotation * startRotation; // Slerp (origin, startRotation, endRotation, builtinDirection, halfAxisLenght, direction, showVectorLabel); InterpolateQuaternions(Quaternion.Slerp, origin, startRotation, endRotation, builtinDirection, halfAxisLenght, direction, showVectorLabel); Quaternion middle = Quaternion.Slerp(startRotation, endRotation, 0.5f); // DrawQuaternion (origin, middle, Color.yellow, 6, direction);//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// GizmosForVector.ShowLabel(origin + middle * direction * halfAxisLenght, //* startRotation // System.Math.Round (Quaternion.Angle (startRotation, endRotation), 0) + "\xB0", Color.magenta); // System.Math.Round ((startRotation * Quaternion.Inverse (endRotation)).SignedAngle ()) + "\xB0", Color.magenta); System.Math.Round((Quaternion.Inverse(endRotation) * startRotation).SignedAngle()) + "\xB0", Color.magenta); //System.Math.Round ((angle), 2) + "\xB0", Color.magenta); //first * Quaternion.Inverse (second) Gizmos.color = temp; }
public static void DrawCoordinateSystem(Vector3 origin, Quaternion rotationOfCoordinateSystem, float axisLenght = 3) { GizmosForVector.DrawVector(origin, rotationOfCoordinateSystem * Vector3.right, axisLenght, Color.red, "x", Vector3.zero, false); GizmosForVector.DrawVector(origin, rotationOfCoordinateSystem * Vector3.up, axisLenght, Color.green, "y", Vector3.zero, false); GizmosForVector.DrawVector(origin, rotationOfCoordinateSystem * Vector3.forward, axisLenght, Color.blue, "z", Vector3.zero, false); }