Пример #1
0
        /// <summary>
        /// Transforms a vector by the given matrix.
        /// </summary>
        /// <param name="position">The vector to transform.</param>
        /// <param name="matrix">The transform matrix.</param>
        /// <returns>The transformed vector.</returns>
        #region public static JVector Transform(JVector position, JMatrix matrix)
        public static TSVector Transform(TSVector position, TSMatrix matrix)
        {
            TSVector result;

            TSVector.Transform(ref position, ref matrix, out result);
            return(result);
        }
Пример #2
0
        /**
         *  @brief Rotates game object based on provided axis, point and angle of rotation.
         **/
        public void RotateAround(TSVector point, TSVector axis, FP angle)
        {
            TSVector vector  = this.position;
            TSVector vector2 = vector - point;

            vector2       = TSVector.Transform(vector2, TSMatrix.AngleAxis(angle * FP.Deg2Rad, axis));
            vector        = point + vector2;
            this.position = vector;

            Rotate(axis, angle);
        }
Пример #3
0
 /**
  *  @brief Moves game object based on provided translation vector and a relative {@link TSTransform}.
  *
  *  The game object will move based on TSTransform's forward vector.
  **/
 public void Translate(TSVector translation, TSTransform relativeTo)
 {
     this.position += TSVector.Transform(translation, TSMatrix.CreateFromQuaternion(relativeTo.rotation));
 }