Class TransformExtensions
- Namespace
- Stride.CommunityToolkit.Engine
- Assembly
- Stride.CommunityToolkit.dll
Extension methods for TransformComponent.
public static class TransformExtensions
- Inheritance
-
TransformExtensions
Fields
WorldUp
The default world up vector. The default is UnitY.
public static Vector3 WorldUp
Field Value
Methods
InverseTransformDirection(TransformComponent, Vector3)
Performs a direction transformation using the inverse of the given WorldMatrix.
public static Vector3 InverseTransformDirection(this TransformComponent transform, Vector3 direction)
Parameters
transform
TransformComponentThe transform to get the world matrix from.
direction
Vector3The direction vector to transform.
Returns
- Vector3
The transformed direction.
Remarks
This method does not update the WorldMatrix before performing the transformation. If the TransformComponent has been modified since the last frame you may need to call the UpdateWorldMatrix() method first.
Exceptions
- ArgumentNullException
If
transform
is null.
InverseTransformDirection(TransformComponent, ref Vector3, out Vector3)
Performs a direction transformation using the inverse of the given WorldMatrix.
public static void InverseTransformDirection(this TransformComponent transform, ref Vector3 direction, out Vector3 result)
Parameters
transform
TransformComponentThe transform to get the world matrix from.
direction
Vector3The direction vector to transform.
result
Vector3The transformed direction.
Remarks
This method does not update the WorldMatrix before performing the transformation. If the TransformComponent has been modified since the last frame you may need to call the UpdateWorldMatrix() method first.
Exceptions
- ArgumentNullException
If
transform
is null.
InverseTransformPosition(TransformComponent, Vector3)
Performs a coordinate transformation using the inverse of the given WorldMatrix.
public static Vector3 InverseTransformPosition(this TransformComponent transform, Vector3 position)
Parameters
transform
TransformComponentThe transform to get the world matrix from.
position
Vector3The coordinate vector to transform.
Returns
- Vector3
The transformed coordinate.
Remarks
This method does not update the WorldMatrix before performing the transformation. If the TransformComponent has been modified since the last frame you may need to call the UpdateWorldMatrix() method first.
Exceptions
- ArgumentNullException
If
transform
is null.
InverseTransformPosition(TransformComponent, ref Vector3, out Vector3)
Performs a coordinate transformation using the inverse of the given WorldMatrix.
public static void InverseTransformPosition(this TransformComponent transform, ref Vector3 position, out Vector3 result)
Parameters
transform
TransformComponentThe transform to get the world matrix from.
position
Vector3The coordinate vector to transform.
result
Vector3The transformed coordinate.
Remarks
This method does not update the WorldMatrix before performing the transformation. If the TransformComponent has been modified since the last frame you may need to call the UpdateWorldMatrix() method first.
Exceptions
- ArgumentNullException
If
transform
is null.
InverseTransformVector(TransformComponent, Vector3)
Performs a normal transformation using the inverse of the given WorldMatrix.
public static Vector3 InverseTransformVector(this TransformComponent transform, Vector3 vector)
Parameters
transform
TransformComponentThe transform to get the world matrix from.
vector
Vector3The normal vector to transform.
Returns
- Vector3
The transformed normal.
Remarks
This method does not update the WorldMatrix before performing the transformation. If the TransformComponent has been modified since the last frame you may need to call the UpdateWorldMatrix() method first.
Exceptions
- ArgumentNullException
If
transform
is null.
InverseTransformVector(TransformComponent, ref Vector3, out Vector3)
Performs a normal transformation using the inverse of the given WorldMatrix.
public static void InverseTransformVector(this TransformComponent transform, ref Vector3 vector, out Vector3 result)
Parameters
transform
TransformComponentThe transform to get the world matrix from.
vector
Vector3The normal vector to transform.
result
Vector3The transformed normal.
Remarks
This method does not update the WorldMatrix before performing the transformation. If the TransformComponent has been modified since the last frame you may need to call the UpdateWorldMatrix() method first.
Exceptions
- ArgumentNullException
If
transform
is null.
LookAt(TransformComponent, Vector3, Vector3, float)
Sets the transforms rotation so it's forward vector points at the target
.
public static void LookAt(this TransformComponent transform, Vector3 target, Vector3 worldUp, float smooth = 1)
Parameters
transform
TransformComponentThe TransformComponent to update.
target
Vector3The target to point towards
worldUp
Vector3A Vector specifying the upward direction.
smooth
floatValue between 0 and 1 indicating the weight of target orientation. The default is 1.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transform
is null.- ArgumentException
LookAt(TransformComponent, Vector3, float)
Sets the transforms rotation so it's forward vector points at the target
.
The world up vector use is defined by WorldUp.
public static void LookAt(this TransformComponent transform, Vector3 target, float smooth = 1)
Parameters
transform
TransformComponentThe TransformComponent to update.
target
Vector3The target to point towards
smooth
floatValue between 0 and 1 indicating the weight of target orientation. The default is 1.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transform
is null.- ArgumentException
LookAt(TransformComponent, ref Vector3, ref Vector3, float)
Sets the transforms rotation so it's forward vector points at the target
.
public static void LookAt(this TransformComponent transform, ref Vector3 target, ref Vector3 worldUp, float smooth = 1)
Parameters
transform
TransformComponentThe TransformComponent to update.
target
Vector3The target to point towards
worldUp
Vector3A Vector specifying the upward direction.
smooth
floatValue between 0 and 1 indicating the weight of target orientation. The default is 1.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transform
is null.- ArgumentException
LookAt(TransformComponent, ref Vector3, float)
Sets the transforms rotation so it's forward vector points at the target
.
The world up vector use is defined by WorldUp.
public static void LookAt(this TransformComponent transform, ref Vector3 target, float smooth = 1)
Parameters
transform
TransformComponentThe TransformComponent to update.
target
Vector3The target to point towards
smooth
floatValue between 0 and 1 indicating the weight of target orientation. The default is 1.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transform
is null.- ArgumentException
LookAt(TransformComponent, TransformComponent, Vector3, float)
Sets the transforms rotation so it's forward vector points at the target
.
public static void LookAt(this TransformComponent transform, TransformComponent target, Vector3 worldUp, float smooth = 1)
Parameters
transform
TransformComponentThe TransformComponent to update.
target
TransformComponentThe target to point towards
worldUp
Vector3A Vector specifying the upward direction.
smooth
floatValue between 0 and 1 indicating the weight of target orientation. The default is 1.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transform
ortarget
is null.- ArgumentException
LookAt(TransformComponent, TransformComponent, ref Vector3, float)
Sets the transforms rotation so it's forward vector points at the target
.
public static void LookAt(this TransformComponent transform, TransformComponent target, ref Vector3 worldUp, float smooth = 1)
Parameters
transform
TransformComponentThe TransformComponent to update.
target
TransformComponentThe target to point towards
worldUp
Vector3A Vector specifying the upward direction.
smooth
floatValue between 0 and 1 indicating the weight of target orientation. The default is 1.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transform
ortarget
is null.- ArgumentException
LookAt(TransformComponent, TransformComponent, float)
Sets the transforms rotation so it's forward vector points at the target
.
The world up vector use is defined by WorldUp.
public static void LookAt(this TransformComponent transform, TransformComponent target, float smooth = 1)
Parameters
transform
TransformComponentThe TransformComponent to update.
target
TransformComponentThe target to point towards
smooth
floatValue between 0 and 1 indicating the weight of target orientation. The default is 1.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transform
ortarget
is null.- ArgumentException
Rotate(TransformComponent, Vector3, Space)
Rotates the given TransformComponent by the specified eulerAngles
in the coordinate space defined by relativeTo
.
public static void Rotate(this TransformComponent transform, Vector3 eulerAngles, Space relativeTo = Space.Self)
Parameters
transform
TransformComponentThe TransformComponent to update.
eulerAngles
Vector3The euler angles in radians to rotate by.
relativeTo
SpaceThe coordinate space to perform the rotation in.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transform
is null.- ArgumentException
Rotate(TransformComponent, ref Vector3, Space)
Rotates the given TransformComponent by the specified eulerAngles
in the coordinate space defined by relativeTo
.
public static void Rotate(this TransformComponent transform, ref Vector3 eulerAngles, Space relativeTo = Space.Self)
Parameters
transform
TransformComponentThe TransformComponent to update.
eulerAngles
Vector3The euler angles in radians to rotate by.
relativeTo
SpaceThe coordinate space to perform the rotation in.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transform
is null.- ArgumentException
TransformDirection(TransformComponent, Vector3)
Performs a direction transformation using the given WorldMatrix.
public static Vector3 TransformDirection(this TransformComponent transform, Vector3 direction)
Parameters
transform
TransformComponentThe transform to get the world matrix from.
direction
Vector3The direction vector to transform.
Returns
- Vector3
The transformed direction.
Remarks
This method does not update the WorldMatrix before performing the transformation. If the TransformComponent has been modified since the last frame you may need to call the UpdateWorldMatrix() method first.
Exceptions
- ArgumentNullException
If
transform
is null.
TransformDirection(TransformComponent, ref Vector3, out Vector3)
Performs a direction transformation using the given WorldMatrix.
public static void TransformDirection(this TransformComponent transform, ref Vector3 direction, out Vector3 result)
Parameters
transform
TransformComponentThe transform to get the world matrix from.
direction
Vector3The direction vector to transform.
result
Vector3The transformed direction.
Remarks
This method does not update the WorldMatrix before performing the transformation. If the TransformComponent has been modified since the last frame you may need to call the UpdateWorldMatrix() method first.
Exceptions
- ArgumentNullException
If
transform
is null.
TransformPosition(TransformComponent, Vector3)
Performs a coordinate transformation using the given WorldMatrix.
public static Vector3 TransformPosition(this TransformComponent transform, Vector3 position)
Parameters
transform
TransformComponentThe transform to get the world matrix from.
position
Vector3The coordinate vector to transform.
Returns
- Vector3
The transformed coordinate.
Remarks
This method does not update the WorldMatrix before performing the transformation. If the TransformComponent has been modified since the last frame you may need to call the UpdateWorldMatrix() method first.
Exceptions
- ArgumentNullException
If
transform
is null.
TransformPosition(TransformComponent, ref Vector3, out Vector3)
Performs a coordinate transformation using the given WorldMatrix.
public static void TransformPosition(this TransformComponent transform, ref Vector3 position, out Vector3 result)
Parameters
transform
TransformComponentThe transform to get the world matrix from.
position
Vector3The coordinate vector to transform.
result
Vector3The transformed coordinate.
Remarks
This method does not update the WorldMatrix before performing the transformation. If the TransformComponent has been modified since the last frame you may need to call the UpdateWorldMatrix() method first.
Exceptions
- ArgumentNullException
If
transform
is null.
TransformVector(TransformComponent, Vector3)
Performs a normal transformation using the given WorldMatrix.
public static Vector3 TransformVector(this TransformComponent transform, Vector3 vector)
Parameters
transform
TransformComponentThe transform to get the world matrix from.
vector
Vector3The normal vector to transform.
Returns
- Vector3
The transformed normal.
Remarks
This method does not update the WorldMatrix before performing the transformation. If the TransformComponent has been modified since the last frame you may need to call the UpdateWorldMatrix() method first.
Exceptions
- ArgumentNullException
If
transform
is null.
TransformVector(TransformComponent, ref Vector3, out Vector3)
Performs a normal transformation using the given WorldMatrix.
public static void TransformVector(this TransformComponent transform, ref Vector3 vector, out Vector3 result)
Parameters
transform
TransformComponentThe transform to get the world matrix from.
vector
Vector3The normal vector to transform.
result
Vector3The transformed normal.
Remarks
This method does not update the WorldMatrix before performing the transformation. If the TransformComponent has been modified since the last frame you may need to call the UpdateWorldMatrix() method first.
Exceptions
- ArgumentNullException
If
transform
is null.
Translate(TransformComponent, Vector3, Space)
Moves the given TransformComponent position by the specified translation
in the coordinate space defined by relativeTo
.
public static void Translate(this TransformComponent transform, Vector3 translation, Space relativeTo = Space.Self)
Parameters
transform
TransformComponentThe TransformComponent to update.
translation
Vector3The translation vector to move by.
relativeTo
SpaceThe coordinate space to perform the translation in.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transform
is null.- ArgumentException
Translate(TransformComponent, Vector3, TransformComponent)
Moves the given TransformComponent position by the specified translation
relative to the local coordinate space of another TransformComponent.
public static void Translate(this TransformComponent transform, Vector3 translation, TransformComponent relativeTo)
Parameters
transform
TransformComponentThe TransformComponent to update.
translation
Vector3The translation vector to move by.
relativeTo
TransformComponentThe TransformComponent to perform the translation relative to.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transform
orrelativeTo
is null.- ArgumentException
Translate(TransformComponent, ref Vector3, Space)
Moves the given TransformComponent position by the specified translation
in the coordinate space defined by relativeTo
.
public static void Translate(this TransformComponent transform, ref Vector3 translation, Space relativeTo = Space.Self)
Parameters
transform
TransformComponentThe TransformComponent to update.
translation
Vector3The translation vector to move by.
relativeTo
SpaceThe coordinate space to perform the translation in.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transform
is null.- ArgumentException
Translate(TransformComponent, ref Vector3, TransformComponent)
Moves the given TransformComponent position by the specified translation
relative to the local coordinate space of another TransformComponent.
public static void Translate(this TransformComponent transform, ref Vector3 translation, TransformComponent relativeTo)
Parameters
transform
TransformComponentThe TransformComponent to update.
translation
Vector3The translation vector to move by.
relativeTo
TransformComponentThe TransformComponent to perform the translation relative to.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transform
orrelativeTo
is null.- ArgumentException
UpdateTRSFromLocal(TransformComponent)
Updates the Position, Rotation and Scale members of the given TransformComponent.
public static void UpdateTRSFromLocal(this TransformComponent transform)
Parameters
transform
TransformComponentThe TransformComponent to update.
Exceptions
- ArgumentNullException
If
transform
is null.