Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::Transform Class Reference

#include <Transform.h>

Public Types

using Axis = Constants::Axis
 

Public Member Functions

 AZ_TYPE_INFO (Transform, "{5D9958E9-9F1E-4985-B532-FFFDE75FEDFD}")
 
 Transform ()=default
 Default constructor does not initialize the matrix.
 
 Transform (const Vector3 &translation, const Quaternion &rotation, float scale)
 Construct a transform from components.
 
Vector3 GetBasis (int index) const
 
Vector3 GetBasisX () const
 
Vector3 GetBasisY () const
 
Vector3 GetBasisZ () const
 
void GetBasisAndTranslation (Vector3 *basisX, Vector3 *basisY, Vector3 *basisZ, Vector3 *pos) const
 
const Vector3GetTranslation () const
 
void SetTranslation (float x, float y, float z)
 
void SetTranslation (const Vector3 &v)
 
const QuaternionGetRotation () const
 
void SetRotation (const Quaternion &rotation)
 
float GetUniformScale () const
 
void SetUniformScale (const float scale)
 
float ExtractUniformScale ()
 Sets the transform's scale to a unit value and returns the previous scale value.
 
void MultiplyByUniformScale (float scale)
 
Transform operator* (const Transform &rhs) const
 
Transformoperator*= (const Transform &rhs)
 
Vector3 TransformPoint (const Vector3 &rhs) const
 
Vector4 TransformPoint (const Vector4 &rhs) const
 
Vector3 TransformVector (const Vector3 &rhs) const
 Applies rotation and scale, but not translation.
 
Transform GetInverse () const
 
void Invert ()
 
bool IsOrthogonal (float tolerance=Constants::Tolerance) const
 
Transform GetOrthogonalized () const
 
void Orthogonalize ()
 
bool IsClose (const Transform &rhs, float tolerance=Constants::Tolerance) const
 
bool operator== (const Transform &rhs) const
 
bool operator!= (const Transform &rhs) const
 
Vector3 GetEulerDegrees () const
 
Vector3 GetEulerRadians () const
 
void SetFromEulerDegrees (const Vector3 &eulerDegrees)
 
void SetFromEulerRadians (const Vector3 &eulerRadians)
 
bool IsFinite () const
 

Static Public Member Functions

static void Reflect (ReflectContext *context)
 
static Transform CreateIdentity ()
 Creates an identity transform.
 
static Transform CreateFromQuaternion (const class Quaternion &q)
 Sets the matrix from a quaternion, translation is set to zero.
 
static Transform CreateFromQuaternionAndTranslation (const class Quaternion &q, const Vector3 &p)
 Sets the matrix from a quaternion and a translation.
 
static Transform CreateFromMatrix3x3 (const class Matrix3x3 &value)
 
static Transform CreateFromMatrix3x3AndTranslation (const class Matrix3x3 &value, const Vector3 &p)
 
static Transform CreateFromMatrix3x4 (const Matrix3x4 &value)
 
static Transform CreateUniformScale (const float scale)
 Sets the transform to apply (uniform) scale only, no rotation or translation.
 
static Transform CreateTranslation (const Vector3 &translation)
 Sets the matrix to be a translation matrix, rotation part is set to identity.
 
static Transform CreateLookAt (const Vector3 &from, const Vector3 &to, Transform::Axis forwardAxis=Transform::Axis::YPositive)
 
static const TransformIdentity ()
 
static Transform CreateRotationX (float angle)
 
static Transform CreateRotationY (float angle)
 
static Transform CreateRotationZ (float angle)
 

Detailed Description

The basic transformation class, represented using a quaternion rotation, float scale and vector translation. By design, cannot represent skew transformations.

Member Function Documentation

◆ CreateFromMatrix3x3()

static Transform AZ::Transform::CreateFromMatrix3x3 ( const class Matrix3x3 value)
static

Constructs from a Matrix3x3, translation is set to zero. Note that Transform only allows uniform scale, so if the matrix has different scale values along its axes, the largest matrix scale value will be used to uniformly scale the Transform.

◆ CreateFromMatrix3x3AndTranslation()

static Transform AZ::Transform::CreateFromMatrix3x3AndTranslation ( const class Matrix3x3 value,
const Vector3 p 
)
static

Constructs from a Matrix3x3 and translation Vector3. Note that Transform only allows uniform scale, so if the matrix has different scale values along its axes, the largest matrix scale value will be used to uniformly scale the Transform.

◆ CreateFromMatrix3x4()

static Transform AZ::Transform::CreateFromMatrix3x4 ( const Matrix3x4 value)
static

Constructs from a Matrix3x4. Note that Transform only allows uniform scale, so if the matrix has different scale values along its axes, the largest matrix scale value will be used to uniformly scale the Transform.

◆ CreateLookAt()

static Transform AZ::Transform::CreateLookAt ( const Vector3 from,
const Vector3 to,
Transform::Axis  forwardAxis = Transform::Axis::YPositive 
)
static

Creates a "look at" transform. Given a source position and target position, computes a transform at the source position that points toward the target along a chosen local-space axis.

Parameters
fromThe source position (world space).
toThe target position (world space).
forwardAxisThe local-space basis axis that should "look at" the target.
Returns
The resulting Matrix3x4 or the identity if the source and target coincide.

◆ CreateRotationX()

AZ_MATH_INLINE Transform AZ::Transform::CreateRotationX ( float  angle)
static

Sets the matrix to be a rotation around a specified axis.

◆ Reflect()

static void AZ::Transform::Reflect ( ReflectContext context)
static

AzCore Reflection.

Parameters
contextreflection context

The documentation for this class was generated from the following files: