Struct Vector3MagnitudeComparer
Compare two Vector3 by magnitude.
Namespace: UnityEngine.InputSystem.Utilities
Assembly: Unity.InputSystem.dll
Syntax
public struct Vector3MagnitudeComparer : IComparer<Vector3>
Examples
public class CompositeWithVector3Part : InputBindingComposite<Vector3> { [InputControl(layout = "Vector3")] public int part;
public override Vector3 ReadValue(ref InputBindingCompositeContext context)
{
// Return the Vector3 with the greatest magnitude.
return context.ReadValue<Vector3, Vector2MagnitudeComparer>(part);
}
}
Methods
Compare(Vector3, Vector3)
Declaration
public int Compare(Vector3 x, Vector3 y)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | x | |
Vector3 | y |
Returns
Type | Description |
---|---|
int |