Ejemplo n.º 1
0
        public static OrbitConstraint Lerp(OrbitConstraint a, OrbitConstraint b, float t)
        {
            AxisConstraint yaw   = AxisConstraint.Lerp(a.m_yaw, b.m_yaw, t);
            AxisConstraint pitch = AxisConstraint.Lerp(a.m_pitch, b.m_pitch, t);
            AxisConstraint roll  = AxisConstraint.Lerp(a.m_roll, b.m_roll, t);

            return(new OrbitConstraint(yaw, pitch, roll));
        }
Ejemplo n.º 2
0
        public static Orbit Lerp(Orbit a, Orbit b, float t)
        {
            float           yaw        = Mathf.LerpAngle(a.yaw, b.yaw, t);
            float           pitch      = Mathf.LerpAngle(a.pitch, b.pitch, t);
            float           roll       = Mathf.LerpAngle(a.roll, b.roll, t);
            OrbitConstraint constraint = OrbitConstraint.Lerp(a.m_constraint, b.m_constraint, t);

            return(new Orbit(yaw, pitch, roll, constraint));
        }
Ejemplo n.º 3
0
 public Orbit(float yaw, float pitch, float roll, OrbitConstraint constraint)
 {
     m_constraint = constraint;
     m_yaw        = constraint.Yaw(yaw);
     m_pitch      = constraint.Pitch(pitch);
     m_roll       = constraint.Roll(roll);
     m_direction  = CalculateDirection(m_yaw, m_pitch);
     m_rotation   = CalculateRotation(m_yaw, m_pitch, m_roll);
 }
Ejemplo n.º 4
0
 public void Clone(Orbit copy)
 {
     m_constraint = copy.m_constraint;
     m_yaw        = copy.yaw;
     m_pitch      = copy.pitch;
     m_roll       = copy.roll;
     m_direction  = copy.m_direction;
     m_rotation   = copy.m_rotation;
 }
Ejemplo n.º 5
0
        private static Orbit QuaternionToOrbit(Quaternion rotation, OrbitConstraint constraint)
        {
            Vector3 angles = rotation.eulerAngles;

            float yaw   = WrapAxis((-angles.y - 90f));
            float pitch = WrapAxis(angles.x);
            float roll  = WrapAxis(-angles.z);

            return(new Orbit(yaw, pitch, roll, constraint));
        }
Ejemplo n.º 6
0
 public Orbit(Quaternion rotation, OrbitConstraint constraint) : this(QuaternionToOrbit(rotation, constraint))
 {
 }
Ejemplo n.º 7
0
 public Orbit(Vector3 direction, Vector3 up, OrbitConstraint constraint) : this(DirectionToOrbit(direction, up, constraint))
 {
 }
Ejemplo n.º 8
0
 public Orbit(float yaw, float pitch, OrbitConstraint constraint) : this(yaw, pitch, OriginRotation, constraint)
 {
 }
Ejemplo n.º 9
0
        private static Orbit DirectionToOrbit(Vector3 direction, Vector3 up, OrbitConstraint constraint)
        {
            Quaternion rotation = Quaternion.LookRotation(direction, up);

            return(QuaternionToOrbit(rotation, constraint));
        }
Ejemplo n.º 10
0
 private static Orbit DirectionToOrbit(Vector3 direction, OrbitConstraint constraint)
 {
     return(DirectionToOrbit(direction, Vector3.up, constraint));
 }
Ejemplo n.º 11
0
        public void Constrain(AxisConstraint yaw, AxisConstraint pitch, AxisConstraint roll)
        {
            OrbitConstraint constraint = new OrbitConstraint(yaw, pitch, roll);

            Constrain(constraint);
        }
Ejemplo n.º 12
0
 public void Constrain(OrbitConstraint constraint)
 {
     m_constraint = constraint;
     WrapAxes();
 }