/// <summary>
        /// The cross product of two vectors.
        /// </summary>
        /// <param name="vector1">The first vector.</param>
        /// <param name="vector2">The second vector.</param>
        /// <returns>The cross product of both vectors.</returns>
        #region public static JVector Cross(JVector vector1, JVector vector2)
        public static FPVector Cross(FPVector vector1, FPVector vector2)
        {
            FPVector result;

            FPVector.Cross(ref vector1, ref vector2, out result);
            return(result);
        }
Beispiel #2
0
        public static FPQuaternion FromToRotation(FPVector fromVector, FPVector toVector)
        {
            FPVector     w = FPVector.Cross(fromVector, toVector);
            FPQuaternion q = new FPQuaternion(w.x, w.y, w.z, FPVector.Dot(fromVector, toVector));

            q.w += FP.Sqrt(fromVector.sqrMagnitude * toVector.sqrMagnitude);
            q.Normalize();

            return(q);
        }
        /// <summary>
        /// Calculates the cross product of two vectors.
        /// </summary>
        /// <param name="value1">The first vector.</param>
        /// <param name="value2">The second vector.</param>
        /// <returns>Returns the cross product of both.</returns>
        #region public static JVector operator %(JVector value1, JVector value2)
        public static FPVector operator %(FPVector value1, FPVector value2)
        {
            FPVector result; FPVector.Cross(ref value1, ref value2, out result);

            return(result);
        }
        /**
         *  @brief Returns the velocity of the body at some position in world space.
         **/
        public FPVector GetPointVelocity(FPVector worldPoint)
        {
            FPVector directionPoint = position - tsCollider.Body.TSPosition;

            return(FPVector.Cross(tsCollider.Body.TSAngularVelocity, directionPoint) + tsCollider.Body.TSLinearVelocity);
        }
        /**
         *  @brief Returns the velocity of the body at some position in world space.
         **/
        public FPVector2 GetPointVelocity(FPVector2 worldPoint)
        {
            FPVector directionPoint = (position - tsCollider.Body.TSPosition).ToFPVector();

            return(FPVector.Cross(new FPVector(0, 0, tsCollider.Body.TSAngularVelocity), directionPoint).ToFPVector2() + tsCollider.Body.TSLinearVelocity);
        }