s&box docs

public sealed struct Matrix

Represents a 4x4 matrix.

Broader workflow and conceptual references connected to this API.

Constructors

Showing 1 constructors

public 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)

Methods

Showing 25 methods

public static Matrix CreateMatrix3D(float[] matrix)

public static Matrix CreateObliqueProjection(Transform cameraTransform, Sandbox.Plane clipPlane, Matrix projectionMatrix)

Create a projection matrix. The matrix will be in the correct format for the engine, and will also be reverse z.

public static Matrix CreateProjection(float zNear, float zFar, float fovX, float aspectRatio, System.Nullable`1<Vector4> clipSpace = null)

Parameters

  • clipSpace: Default: null

public static Matrix CreateSkewX(float degrees)

public static Matrix CreateSkewY(float degrees)

public static Matrix Lerp(Matrix ma, Matrix mb, float frac)

Performs linear interpolation from one matrix to another.

public static Matrix Slerp(Matrix ma, Matrix mb, float frac)

Performs spherical interpolation from one matrix to another.

public Vector3 TransformNormal(Vector3 v)

Transforms a normal vector by a specified 4x4 matrix

public Matrix Transpose()

Returns transposed version of this matrix, meaning columns in this matrix become rows in the returned matrix and rows in this matrix become columns in the returned one.

Properties

Showing 18 properties

public static Matrix Matrix.Identity { get; set; }

Returns the multiplicative identity matrix.

public Matrix Matrix.Inverted { get; set; }

Returns inverse of this matrix.

public float Matrix.M11 { get; set; }

public float Matrix.M12 { get; set; }

public float Matrix.M13 { get; set; }

public float Matrix.M14 { get; set; }

public float Matrix.M21 { get; set; }

public float Matrix.M22 { get; set; }

public float Matrix.M23 { get; set; }

public float Matrix.M24 { get; set; }

public float Matrix.M31 { get; set; }

public float Matrix.M32 { get; set; }

public float Matrix.M33 { get; set; }

public float Matrix.M34 { get; set; }

public float Matrix.M41 { get; set; }

public float Matrix.M42 { get; set; }

public float Matrix.M43 { get; set; }

public float Matrix.M44 { get; set; }

Metadata

FieldValue
Namespaceglobal
Typeclass
AssemblySandbox.System
Doc IDT:Matrix

On this page

Constructorspublic Matrix(System.Single m11, System.Single m12, System.Single m13, System.Single m14, System.Single m21, System.Single m22, System.Single m23, System.Single m24, System.Single m31, System.Single m32, System.Single m33, System.Single m34, System.Single m41, System.Single m42, System.Single m43, System.Single m44)Methodspublic static Matrix CreateMatrix3D(System.Single[] matrix)public static Matrix CreateObliqueProjection(Transform cameraTransform, Sandbox.Plane clipPlane, Matrix projectionMatrix)public static Matrix CreateProjection(System.Single zNear, System.Single zFar, System.Single fovX, System.Single aspectRatio, System.Nullable`1<Vector4> clipSpace = null)public static Matrix CreateRotation(Rotation rot)public static Matrix CreateRotation(Vector3 angles)public static Matrix CreateRotationX(System.Single degrees, Vector3 center)public static Matrix CreateRotationX(System.Single degrees)public static Matrix CreateRotationY(System.Single degrees, Vector3 center)public static Matrix CreateRotationY(System.Single degrees)public static Matrix CreateRotationZ(System.Single degrees, Vector3 center)public static Matrix CreateRotationZ(System.Single degrees)public static Matrix CreateScale(Vector3 scales, Vector3 centerPoint)public static Matrix CreateScale(Vector3 scales)public static Matrix CreateSkew(Vector2 skew)public static Matrix CreateSkewX(System.Single degrees)public static Matrix CreateSkewY(System.Single degrees)public static Matrix CreateTranslation(Vector3 vec)public static Matrix CreateWorld(Vector3 position, Vector3 forward, Vector3 up)public static Matrix Lerp(Matrix ma, Matrix mb, System.Single frac)public static Matrix Slerp(Matrix ma, Matrix mb, System.Single frac)public Vector2 Transform(Vector2 v)public Vector3 Transform(Vector3 v)public Vector4 Transform(Vector4 v)public Vector3 TransformNormal(Vector3 v)public Matrix Transpose()Propertiespublic static Matrix Matrix.Identity { get; set; }public Matrix Matrix.Inverted { get; set; }public System.Single Matrix.M11 { get; set; }public System.Single Matrix.M12 { get; set; }public System.Single Matrix.M13 { get; set; }public System.Single Matrix.M14 { get; set; }public System.Single Matrix.M21 { get; set; }public System.Single Matrix.M22 { get; set; }public System.Single Matrix.M23 { get; set; }public System.Single Matrix.M24 { get; set; }public System.Single Matrix.M31 { get; set; }public System.Single Matrix.M32 { get; set; }public System.Single Matrix.M33 { get; set; }public System.Single Matrix.M34 { get; set; }public System.Single Matrix.M41 { get; set; }public System.Single Matrix.M42 { get; set; }public System.Single Matrix.M43 { get; set; }public System.Single Matrix.M44 { get; set; }Metadata