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
transformTransformComponentThe transform to get the world matrix from.
directionVector3The 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
transformis 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
transformTransformComponentThe transform to get the world matrix from.
directionVector3The direction vector to transform.
resultVector3The 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
transformis 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
transformTransformComponentThe transform to get the world matrix from.
positionVector3The 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
transformis 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
transformTransformComponentThe transform to get the world matrix from.
positionVector3The coordinate vector to transform.
resultVector3The 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
transformis 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
transformTransformComponentThe transform to get the world matrix from.
vectorVector3The 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
transformis 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
transformTransformComponentThe transform to get the world matrix from.
vectorVector3The normal vector to transform.
resultVector3The 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
transformis 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
transformTransformComponentThe TransformComponent to update.
targetVector3The target to point towards
worldUpVector3A Vector specifying the upward direction.
smoothfloatValue 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
transformis 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
transformTransformComponentThe TransformComponent to update.
targetVector3The target to point towards
smoothfloatValue 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
transformis 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
transformTransformComponentThe TransformComponent to update.
targetVector3The target to point towards
worldUpVector3A Vector specifying the upward direction.
smoothfloatValue 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
transformis 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
transformTransformComponentThe TransformComponent to update.
targetVector3The target to point towards
smoothfloatValue 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
transformis 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
transformTransformComponentThe TransformComponent to update.
targetTransformComponentThe target to point towards
worldUpVector3A Vector specifying the upward direction.
smoothfloatValue 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
transformortargetis 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
transformTransformComponentThe TransformComponent to update.
targetTransformComponentThe target to point towards
worldUpVector3A Vector specifying the upward direction.
smoothfloatValue 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
transformortargetis 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
transformTransformComponentThe TransformComponent to update.
targetTransformComponentThe target to point towards
smoothfloatValue 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
transformortargetis 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
transformTransformComponentThe TransformComponent to update.
eulerAnglesVector3The euler angles in radians to rotate by.
relativeToSpaceThe coordinate space to perform the rotation in.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transformis 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
transformTransformComponentThe TransformComponent to update.
eulerAnglesVector3The euler angles in radians to rotate by.
relativeToSpaceThe coordinate space to perform the rotation in.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transformis null.- ArgumentException
TransformDirection(TransformComponent, Vector3)
Performs a direction transformation using the given WorldMatrix.
public static Vector3 TransformDirection(this TransformComponent transform, Vector3 direction)
Parameters
transformTransformComponentThe transform to get the world matrix from.
directionVector3The 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
transformis 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
transformTransformComponentThe transform to get the world matrix from.
directionVector3The direction vector to transform.
resultVector3The 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
transformis null.
TransformPosition(TransformComponent, Vector3)
Performs a coordinate transformation using the given WorldMatrix.
public static Vector3 TransformPosition(this TransformComponent transform, Vector3 position)
Parameters
transformTransformComponentThe transform to get the world matrix from.
positionVector3The 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
transformis 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
transformTransformComponentThe transform to get the world matrix from.
positionVector3The coordinate vector to transform.
resultVector3The 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
transformis null.
TransformVector(TransformComponent, Vector3)
Performs a normal transformation using the given WorldMatrix.
public static Vector3 TransformVector(this TransformComponent transform, Vector3 vector)
Parameters
transformTransformComponentThe transform to get the world matrix from.
vectorVector3The 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
transformis 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
transformTransformComponentThe transform to get the world matrix from.
vectorVector3The normal vector to transform.
resultVector3The 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
transformis 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
transformTransformComponentThe TransformComponent to update.
translationVector3The translation vector to move by.
relativeToSpaceThe coordinate space to perform the translation in.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transformis 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
transformTransformComponentThe TransformComponent to update.
translationVector3The translation vector to move by.
relativeToTransformComponentThe TransformComponent to perform the translation relative to.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transformorrelativeTois 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
transformTransformComponentThe TransformComponent to update.
translationVector3The translation vector to move by.
relativeToSpaceThe coordinate space to perform the translation in.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transformis 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
transformTransformComponentThe TransformComponent to update.
translationVector3The translation vector to move by.
relativeToTransformComponentThe TransformComponent to perform the translation relative to.
Remarks
This method updates the LocalMatrix and WorldMatrix after transformation.
Exceptions
- ArgumentNullException
If
transformorrelativeTois null.- ArgumentException
UpdateTRSFromLocal(TransformComponent)
Updates the Position, Rotation and Scale members of the given TransformComponent.
public static void UpdateTRSFromLocal(this TransformComponent transform)
Parameters
transformTransformComponentThe TransformComponent to update.
Exceptions
- ArgumentNullException
If
transformis null.