Struct ClosestHitCollector<T>
A collector which stores only the closest hit.
Implements
ICollector<T>
Inherited Members
Namespace: Unity.Physics
Assembly: Unity.Physics.dll
Syntax
public struct ClosestHitCollector<T> : ICollector<T> where T : struct, IQueryResult
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Constructors
ClosestHitCollector(float)
Constructor.
Declaration
public ClosestHitCollector(float maxFraction)
Parameters
Type | Name | Description |
---|---|---|
float | maxFraction | The maximum fraction. |
Properties
ClosestHit
Gets the closest hit.
Declaration
public T ClosestHit { get; }
Property Value
Type | Description |
---|---|
T | The closest hit. |
EarlyOutOnFirstHit
Gets a value indicating whether the early out on first hit.
Declaration
public bool EarlyOutOnFirstHit { get; }
Property Value
Type | Description |
---|---|
bool | False. |
MaxFraction
Gets or sets the maximum fraction.
Declaration
public readonly float MaxFraction { get; }
Property Value
Type | Description |
---|---|
float | The maximum fraction. |
NumHits
Gets the number of hits.
Declaration
public readonly int NumHits { get; }
Property Value
Type | Description |
---|---|
int | The total number of hits (0 or 1). |
Methods
AddHit(T)
Adds a hit.
Declaration
public bool AddHit(T hit)
Parameters
Type | Name | Description |
---|---|---|
T | hit | The hit. |
Returns
Type | Description |
---|---|
bool | True. |