TransformExt.GetClosestAxis Method
Gets a vector representing the axis from a Transform that has the smallest angle to a given world-space vector. The returned vector may be any of the three positive or negative axes in world space of the Transform.
Namespace: UltimateXR.Extensions.Unity
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0
Syntax
C#
public static Vector3 GetClosestAxis(
this Transform self,
Vector3 vector
)
Parameters
- self
- Type: Transform
Transform whose axes to compare to the given vector - vector
- Type: Vector3
World-space vector to compare
Return Value
Type: Vector3
A world-space vector representing the positive or negative axis with the smallest angle to the vector
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Transform. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).