/// <summary>
 /// Returns a rotation matrix with position <0,0,0> according to vector x and z
 /// </summary>
 /// <param name="x"> the x vector</param>
 /// <param name="z">the z vector</param>
 /// <returns>Rotation matrix</returns>
 public static Matrix4 GetOrientationMatrix(Vector3 x, Vector3 z)
 {
     x.NormalizeFast();
     z.NormalizeFast();
     Vector3 y = Vector3.Cross(z, x);
     return GetMatrix(Vector3.Zero, z, y, Vector3.Cross(y, z));
 }
示例#2
0
        public void Move(float x, float y, float z)
        {//Adjusts camera position
            OpenTK.Vector3 offset = new OpenTK.Vector3();

            OpenTK.Vector3 forward = new OpenTK.Vector3((float)Math.Sin((float)Orientation.X), 0, (float)Math.Cos((float)Orientation.X));
            OpenTK.Vector3 right   = new OpenTK.Vector3(-forward.Z, 0, forward.X);

            offset   += x * right;
            offset   += y * forward;
            offset.Y += z;

            offset.NormalizeFast();
            offset = OpenTK.Vector3.Multiply(offset, Speed);

            Position += offset;
        }