TransformDirections
Transforms multiple directions from local space to world space writing the transformed directions to a possibly different location.
Read time 2 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
TransformDirections(ReadOnlySpan<Vector3>, Span<Vector3>)
Transforms multiple directions from local space to world space writing the transformed directions to a possibly different location.
public void TransformDirections(ReadOnlySpan<Vector3> directions, Span<Vector3> transformedDirections)
Parameters
The directions to be transformed, these vectors are not modified by the function unless the span overlaps.
transformedDirectionsReceives the transformed directions, must be the same length as otherwise an exception will be thrown. If this span overlaps other than representing the exact same elements the behaviour is undefined.
directionsdirectionsRemarks
This operation is not affected by scale or position of the transform. The transformed vectors have the same length as the original versions.
If you need the inverse operation to transform from world space to local space you can use TransformHandle.InverseTransformDirections
You should use TransformHandle.TransformPoints for the conversion if the vectors represent positions rather than directions.
Additional Resources: TransformHandle.TransformDirection, TransformHandle.InverseTransformDirections, TransformHandle.TransformPoints, TransformHandle.TransformVectors.
TransformDirections(Span<Vector3>)
Transforms multiple directions from local space to world space overwriting each original direction with the transformed version.
public void TransformDirections(Span<Vector3> directions)
Parameters
The directions to be transformed, each is replaced by the transformed version.
Remarks
This operation is not affected by scale or position of the transform. The transformed vectors have the same length as the original versions.
If you need the inverse operation to transform from world space to local space you can use TransformHandle.InverseTransformDirections
You should use TransformHandle.TransformPoints for the conversion if the vectors represent positions rather than directions.