Click or drag to resize

Transform Structure

3×4 matrix (3 rows, 4 columns) used for 3D linear transformations. It can represent transformations such as translation, rotation, or scaling. It consists of a Basis (first 3 columns) and a Vector3 for the origin (last column). For more information, read this documentation article: https://docs.godotengine.org/en/3.3/tutorials/math/matrices_and_transforms.html

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
[SerializableAttribute]
public struct Transform : IEquatable<Transform>

The Transform type exposes the following members.

Constructors
  NameDescription
Public methodTransform(Basis, Vector3)
Constructs a transformation matrix from the given basis and origin vector.
Public methodTransform(Quat, Vector3)
Constructs a transformation matrix from the given quaternion and origin vector.
Public methodTransform(Vector3, Vector3, Vector3, Vector3)
Constructs a transformation matrix from 4 vectors (matrix columns).
Top
Properties
  NameDescription
Public propertyStatic memberFlipX
The transform that will flip something along the X axis.
Public propertyStatic memberFlipY
The transform that will flip something along the Y axis.
Public propertyStatic memberFlipZ
The transform that will flip something along the Z axis.
Public propertyStatic memberIdentity
The identity transform, with no translation, rotation, or scaling applied. This is used as a replacement for `Transform()` in GDScript. Do not use `new Transform()` with no arguments in C#, because it sets all values to zero.
Public propertyItemInt32
Access whole columns in the form of Vector3. The fourth column is the origin vector.
Public propertyItemInt32, Int32
Access matrix elements in column-major order. The fourth column is the origin vector.
Top
Methods
  NameDescription
Public methodAffineInverse
Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling, and translation.
Public methodEquals(Object) (Overrides ValueTypeEquals(Object).)
Public methodEquals(Transform)
Public methodGetHashCode (Overrides ValueTypeGetHashCode.)
Public methodGetType (Inherited from Object.)
Public methodInterpolateWith
Interpolates this transform to the other `transform` by `weight`.
Public methodInverse
Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use AffineInverse for transforms with scaling).
Public methodIsEqualApprox
Returns true if this transform and `other` are approximately equal, by running IsEqualApprox(Vector3) on each component.
Public methodLookingAt
Returns a copy of the transform rotated such that its -Z axis (forward) points towards the target position. The transform will first be rotated around the given up vector, and then fully aligned to the target by a further rotation around an axis perpendicular to both the target and up vectors. Operations take place in global space.
Public methodOrthonormalized
Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors (scale of 1 or -1).
Public methodRotated
Rotates the transform around the given `axis` by `phi` (in radians), using matrix multiplication. The axis must be a normalized vector.
Public methodScaled
Scales the transform by the given 3D scaling factor, using matrix multiplication.
Public methodSetLookAt
Public methodToString (Overrides ValueTypeToString.)
Public methodToString(String)
Public methodTranslated
Translates the transform by the given `offset`, relative to the transform's basis vectors. Unlike Rotated(Vector3, Single) and Scaled(Vector3), this does not use matrix multiplication.
Public methodXform
Returns a vector transformed (multiplied) by this transformation matrix.
Public methodXformInv
Returns a vector transformed (multiplied) by the transposed transformation matrix. Note: This results in a multiplication by the inverse of the transformation matrix only if it represents a rotation-reflection.
Top
Operators
Fields
  NameDescription
Public fieldbasis
The Basis of this transform. Contains the X, Y, and Z basis vectors (columns 0 to 2) and is responsible for rotation and scale.
Public fieldorigin
The origin vector (column 3, the fourth column). Equivalent to array index `[3]`.
Top
See Also