Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateLookAt() [2/2]

static Matrix Microsoft.Xna.Framework.Matrix.CreateLookAt ( Vector3 cameraPosition,
Vector3 cameraTarget,
Vector3 cameraUpVector )
inlinestatic

Definition at line 1084 of file Matrix.cs.

1085 {
1086 Vector3 vector = Vector3.Normalize(cameraPosition - cameraTarget);
1087 Vector3 vector2 = Vector3.Normalize(Vector3.Cross(cameraUpVector, vector));
1088 Vector3 vector3 = Vector3.Cross(vector, vector2);
1089 Matrix result = default(Matrix);
1090 result.M11 = vector2.X;
1091 result.M12 = vector3.X;
1092 result.M13 = vector.X;
1093 result.M14 = 0f;
1094 result.M21 = vector2.Y;
1095 result.M22 = vector3.Y;
1096 result.M23 = vector.Y;
1097 result.M24 = 0f;
1098 result.M31 = vector2.Z;
1099 result.M32 = vector3.Z;
1100 result.M33 = vector.Z;
1101 result.M34 = 0f;
1102 result.M41 = 0f - Vector3.Dot(vector2, cameraPosition);
1103 result.M42 = 0f - Vector3.Dot(vector3, cameraPosition);
1104 result.M43 = 0f - Vector3.Dot(vector, cameraPosition);
1105 result.M44 = 1f;
1106 return result;
1107 }
Matrix(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
Definition Matrix.cs:210

References Microsoft.Xna.Framework.Vector3.Cross(), Microsoft.Xna.Framework.Vector3.Dot(), Microsoft.Xna.Framework.Vector3.Normalize(), Microsoft.Xna.Framework.Vector3.X, Microsoft.Xna.Framework.Vector3.Y, and Microsoft.Xna.Framework.Vector3.Z.