API reference
API reference
Select your platform
No SDKs available
No versions available

ICandidateComparer Interface

Defines a comparison mechanism for prioritizing interactors based on their candidate properties within an InteractorGroup.
This interface enables custom sorting logic for determining which interactor should take precedence when multiple interactors are competing for interaction with the same target.
This interface is crucial for:
  • Implementing distance-based priority systems for interactors
  • Creating custom sorting logic for interaction candidates
  • Managing complex multi-interactor scenarios
For implementation examples, see Oculus.Interaction.CandidatePositionComparer.

Methods

Compare ( a , b )
Compares two candidate objects to determine their relative priority.
The implementation should be consistent with the standard comparison contract:
  • If Compare(x,y) returns negative, then Compare(y,x) should return positive
  • If Compare(x,y) returns zero, then Compare(y,x) should return zero
  • If Compare(x,y) returns positive, then Compare(y,x) should return negative
Signature
int Oculus.Interaction.ICandidateComparer.Compare(object a, object b)
Parameters
a: object  The first candidate object to compare
b: object  The second candidate object to compare
Returns
int  A negative value if a should be prioritized over b, zero if they have equal priority, or a positive value if b should be prioritized over a