Entry point for lag compensated Hitbox queries, which maintains a history buffer, and provides lag compensated raycast and overlap methods. Singleton instance is accessible through the property Runner.LagCompensation. More...
Inherits SimulationBehaviour, IAfterTick, IBeforeSimulation, and ISpawned.
Public Member Functions | |
void | GetPlayerTickAndAlpha (PlayerRef player, out int? tickFrom, out int? tickTo, out float? alpha) |
Gets the tick and alpha interpolate values for a player. More... | |
LagCompensationStatisticsSnapshot | GetStatisticsSnapshot () |
Gets a snapshot of the lag compensation statistics. More... | |
int | OverlapBox (BoxOverlapQuery query, List< LagCompensatedHit > hits, bool clearHits=true) |
Performs a lag-compensated box overlap query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. More... | |
int | OverlapBox (Vector3 center, Vector3 extents, Quaternion orientation, int tick, int? tickTo, float? alpha, List< LagCompensatedHit > hits, int layerMask=-1, HitOptions options=HitOptions.None, bool clearHits=true, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal, PreProcessingDelegate preProcessRoots=null) |
Performs a lag-compensated box overlap query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. More... | |
int | OverlapBox (Vector3 center, Vector3 extents, Quaternion orientation, PlayerRef player, List< LagCompensatedHit > hits, int layerMask=-1, HitOptions options=HitOptions.None, bool clearHits=true, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal, PreProcessingDelegate preProcessRoots=null) |
Performs a lag-compensated box overlap query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. More... | |
int | OverlapSphere (SphereOverlapQuery query, List< LagCompensatedHit > hits, bool clearHits=true) |
Performs a lag-compensated sphere overlap query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. More... | |
int | OverlapSphere (Vector3 origin, float radius, int tick, int? tickTo, float? alpha, List< LagCompensatedHit > hits, int layerMask=-1, HitOptions options=HitOptions.None, bool clearHits=true, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal, PreProcessingDelegate preProcessRoots=null) |
Performs a lag-compensated overlap sphere query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. More... | |
int | OverlapSphere (Vector3 origin, float radius, PlayerRef player, List< LagCompensatedHit > hits, int layerMask=-1, HitOptions options=HitOptions.None, bool clearHits=true, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal, PreProcessingDelegate preProcessRoots=null) |
Performs a lag-compensated overlap sphere query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. More... | |
void | PositionRotation (Hitbox hitbox, int tick, out Vector3 position, out Quaternion rotation, bool subtickAccuracy=false, int? tickTo=null, float? alpha=null) |
Performs a lag-compensated query for a specific Hitbox position and rotation. More... | |
void | PositionRotation (Hitbox hitbox, PlayerRef player, out Vector3 position, out Quaternion rotation, bool subTickAccuracy=false) |
Performs a lag-compensated query for a specific Hitbox position and rotation. More... | |
bool | Raycast (RaycastQuery query, out LagCompensatedHit hit) |
Performs a lag-compensated raycast query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. More... | |
bool | Raycast (Vector3 origin, Vector3 direction, float length, int tick, int? tickTo, float? alpha, out LagCompensatedHit hit, int layerMask=-1, HitOptions options=HitOptions.None, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal, PreProcessingDelegate preProcessRoots=null) |
Performs a lag-compensated raycast query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. More... | |
bool | Raycast (Vector3 origin, Vector3 direction, float length, PlayerRef player, out LagCompensatedHit hit, int layerMask=-1, HitOptions options=HitOptions.None, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal, PreProcessingDelegate preProcessRoots=null) |
Performs a lag-compensated raycast query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. More... | |
int | RaycastAll (RaycastAllQuery query, List< LagCompensatedHit > hits, bool clearHits=true) |
Performs a lag-compensated raycast query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. More... | |
int | RaycastAll (Vector3 origin, Vector3 direction, float length, int tick, int? tickTo, float? alpha, List< LagCompensatedHit > hits, int layerMask=-1, bool clearHits=true, HitOptions options=HitOptions.None, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal, PreProcessingDelegate preProcessRoots=null) |
Performs a lag-compensated raycast query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. Important: results are NOT sorted by distance. More... | |
int | RaycastAll (Vector3 origin, Vector3 direction, float length, PlayerRef player, List< LagCompensatedHit > hits, int layerMask=-1, bool clearHits=true, HitOptions options=HitOptions.None, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal, PreProcessingDelegate preProcessRoots=null) |
Performs a lag-compensated raycast query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. Important: results are NOT sorted by distance. More... | |
Public Member Functions inherited from SimulationBehaviour | |
virtual void | FixedUpdateNetwork () |
Fusion FixedUpdate timing callback. More... | |
virtual void | Render () |
Post simulation frame rendering callback. Runs after all simulations have finished. Use in place of Unity's Update when Fusion is handling Physics. More... | |
Public Member Functions inherited from Behaviour | |
T | AddBehaviour< T > () |
Wrapper for Unity's GameObject.AddComponent() More... | |
T | GetBehaviour< T > () |
Wrapper for Unity's GameObject.GetComponentInChildren() More... | |
bool | TryGetBehaviour< T > (out T behaviour) |
Wrapper for Unity's GameObject.TryGetComponent() More... | |
Public Attributes | |
int | BVHDepth |
Debug data from Broadphase BVH (tree depth). More... | |
int | BVHNodes |
Debug data from Broadphase BVH (total nodes count). More... | |
LagCompensationDraw | DrawInfo |
Debug data used to draw the BVH nodes and the lag compensation history. More... | |
int | TotalHitboxes |
Debug data from lag compensation history (registered Hitbox count). More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Behaviour | |
static void | DestroyBehaviour (Behaviour behaviour) |
Wrapper for Unity's GameObject.Destroy() More... | |
Properties inherited from SimulationBehaviour | |
bool | CanReceiveRenderCallback [get] |
Gets a value indicating whether this instance can receive render callbacks. More... | |
bool | CanReceiveSimulationCallback [get] |
Gets a value indicating whether this instance can receive simulation callbacks. More... | |
NetworkObject | Object [get] |
The NetworkObject this component is associated with. More... | |
NetworkRunner | Runner [get] |
The NetworkRunner this component is associated with. More... | |
Entry point for lag compensated Hitbox queries, which maintains a history buffer, and provides lag compensated raycast and overlap methods. Singleton instance is accessible through the property Runner.LagCompensation.
Usage - Call any of the following methods:
HitboxManager.Raycast()
HitboxManager.RaycastAll()
HitboxManager.PositionRotation()
HitboxManager.OverlapSphere()
These methods use the history buffer to perform a Hitbox query against a state consistent with how the indicated PlayerRef perceived them locally.
void GetPlayerTickAndAlpha | ( | PlayerRef | player, |
out int? | tickFrom, | ||
out int? | tickTo, | ||
out float? | alpha | ||
) |
Gets the tick and alpha interpolate values for a player.
player | The player reference. |
tickFrom | The tick value from which to interpolate. |
tickTo | The tick value to which to interpolate. |
alpha | The interpolation alpha value. |
LagCompensationStatisticsSnapshot GetStatisticsSnapshot | ( | ) |
Gets a snapshot of the lag compensation statistics.
int OverlapBox | ( | BoxOverlapQuery | query, |
List< LagCompensatedHit > | hits, | ||
bool | clearHits = true |
||
) |
Performs a lag-compensated box overlap query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes.
query | The query containing all necessary information. |
hits | List to be filled with hits (both hitboxes and/or static colliders, if included). |
clearHits | Clear list of hits before filling with new ones (defaults to true). |
int OverlapBox | ( | Vector3 | center, |
Vector3 | extents, | ||
Quaternion | orientation, | ||
int | tick, | ||
int? | tickTo, | ||
float? | alpha, | ||
List< LagCompensatedHit > | hits, | ||
int | layerMask = -1 , |
||
HitOptions | options = HitOptions.None , |
||
bool | clearHits = true , |
||
QueryTriggerInteraction | queryTriggerInteraction = QueryTriggerInteraction.UseGlobal , |
||
PreProcessingDelegate | preProcessRoots = null |
||
) |
Performs a lag-compensated box overlap query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes.
center | Center of the box in world space. |
extents | Half of the size of the box in each dimension. |
orientation | Rotation of the box. |
tick | The exact tick to be queried |
tickTo | Simulation tick number to use as the time reference for the lag compensation. If provided, must be combined with the alpha parameter for interpolation between tick and tickTo . If HitOptions.SubtickAccuracy is included on options , this query will be resolved against hitbox colliders interpolated between the specified ticks. Otherwise, only one of the two ticks will be considered, according to the rounded value of alpha . |
alpha | Interpolation value when querying between tick and tickTo . If HitOptions.SubtickAccuracy is included on options , this query will be resolved against hitbox colliders interpolated between the specified ticks. Otherwise, only one of the two ticks will be considered, according to the rounded alpha value. |
hits | List to be filled with hits (both hitboxes and/or static colliders, if included). |
layerMask | Only objects with matching layers will be checked against. |
options | Opt-in flags to compute with sub-tick accuracy (HitOptions.SubtickAccuracy) and/or to include PhysX (HitOptions.IncludePhysX) or Box2D (HitOptions.IncludeBox2D). |
clearHits | Clear list of hits before filling with new ones (defaults to true). |
queryTriggerInteraction | Trigger interaction behavior when also querying PhysX. |
preProcessRoots | Delegate to pre-process HitboxRoots found in the broad-phase resolution of the query. Roots removed from the list will not be processed any further. Roots that remain on the candidates collection will be normally processed and fitting colliders will be evaluated in the query narrow-phase resolution. Hitbox collider indices added to the processed set will be evaluated in the narrow-phase regardless of further root processing steps (e.g. layer mask match). |
int OverlapBox | ( | Vector3 | center, |
Vector3 | extents, | ||
Quaternion | orientation, | ||
PlayerRef | player, | ||
List< LagCompensatedHit > | hits, | ||
int | layerMask = -1 , |
||
HitOptions | options = HitOptions.None , |
||
bool | clearHits = true , |
||
QueryTriggerInteraction | queryTriggerInteraction = QueryTriggerInteraction.UseGlobal , |
||
PreProcessingDelegate | preProcessRoots = null |
||
) |
Performs a lag-compensated box overlap query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes.
center | Center of the box in world space. |
extents | Half of the size of the box in each dimension. |
orientation | Rotation of the box. |
player | Player who "owns" this overlap. Used by the server to find the exact hitbox snapshots to check against. |
hits | List to be filled with hits (both hitboxes and/or static colliders, if included). |
layerMask | Only objects with matching layers will be checked against. |
options | Opt-in flags to compute with sub-tick accuracy (HitOptions.SubtickAccuracy) and/or to include PhysX (HitOptions.IncludePhysX) or Box2D (HitOptions.IncludeBox2D). |
clearHits | Clear list of hits before filling with new ones (defaults to true). |
queryTriggerInteraction | Trigger interaction behavior when also querying PhysX. |
preProcessRoots | Delegate to pre-process HitboxRoots found in the broad-phase resolution of the query. Roots removed from the list will not be processed any further. Roots that remain on the candidates collection will be normally processed and fitting colliders will be evaluated in the query narrow-phase resolution. Hitbox collider indices added to the processed set will be evaluated in the narrow-phase regardless of further root processing steps (e.g. layer mask match). |
int OverlapSphere | ( | SphereOverlapQuery | query, |
List< LagCompensatedHit > | hits, | ||
bool | clearHits = true |
||
) |
Performs a lag-compensated sphere overlap query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes.
query | The query containing all necessary information. |
hits | List to be filled with hits (both hitboxes and/or static colliders, if included). |
clearHits | Clear list of hits before filling with new ones (defaults to true). |
int OverlapSphere | ( | Vector3 | origin, |
float | radius, | ||
int | tick, | ||
int? | tickTo, | ||
float? | alpha, | ||
List< LagCompensatedHit > | hits, | ||
int | layerMask = -1 , |
||
HitOptions | options = HitOptions.None , |
||
bool | clearHits = true , |
||
QueryTriggerInteraction | queryTriggerInteraction = QueryTriggerInteraction.UseGlobal , |
||
PreProcessingDelegate | preProcessRoots = null |
||
) |
Performs a lag-compensated overlap sphere query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes.
origin | Sphere center, in world-space |
radius | Sphere radius |
tick | The tick to be queried |
tickTo | Simulation tick number to use as the time reference for the lag compensation. If provided, must be combined with the alpha parameter for interpolation between tick and tickTo . If HitOptions.SubtickAccuracy is included on options , this query will be resolved against hitbox colliders interpolated between the specified ticks. Otherwise, only one of the two ticks will be considered, according to the rounded value of alpha . |
alpha | Interpolation value when querying between tick and tickTo . If HitOptions.SubtickAccuracy is included on options , this query will be resolved against hitbox colliders interpolated between the specified ticks. Otherwise, only one of the two ticks will be considered, according to the rounded alpha value. |
hits | List to be filled with hits (both hitboxes and/or static colliders, if included). |
layerMask | Only objects with matching layers will be checked against. |
options | Opt-in flags to compute with sub-tick accuracy (HitOptions.SubtickAccuracy) and/or to include PhysX (HitOptions.IncludePhysX) or Box2D (HitOptions.IncludeBox2D). |
clearHits | Clear list of hits before filling with new ones (defaults to true). |
queryTriggerInteraction | Trigger interaction behavior when also querying PhysX. |
preProcessRoots | Delegate to pre-process HitboxRoots found in the broad-phase resolution of the query. Roots removed from the list will not be processed any further. Roots that remain on the candidates collection will be normally processed and fitting colliders will be evaluated in the query narrow-phase resolution. Hitbox collider indices added to the processed set will be evaluated in the narrow-phase regardless of further root processing steps (e.g. layer mask match). |
int OverlapSphere | ( | Vector3 | origin, |
float | radius, | ||
PlayerRef | player, | ||
List< LagCompensatedHit > | hits, | ||
int | layerMask = -1 , |
||
HitOptions | options = HitOptions.None , |
||
bool | clearHits = true , |
||
QueryTriggerInteraction | queryTriggerInteraction = QueryTriggerInteraction.UseGlobal , |
||
PreProcessingDelegate | preProcessRoots = null |
||
) |
Performs a lag-compensated overlap sphere query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes.
origin | Sphere center, in world-space |
radius | Sphere radius |
player | Player who "owns" this overlap. Used by the server to find the exact hitbox snapshots to check against. |
hits | List to be filled with hits (both hitboxes and/or static colliders, if included). |
layerMask | Only objects with matching layers will be checked against. |
options | Opt-in flags to compute with sub-tick accuracy (HitOptions.SubtickAccuracy) and/or to include PhysX (HitOptions.IncludePhysX) or Box2D (HitOptions.IncludeBox2D). |
clearHits | Clear list of hits before filling with new ones (defaults to true). |
queryTriggerInteraction | Trigger interaction behavior when also querying PhysX. |
preProcessRoots | Delegate to pre-process HitboxRoots found in the broad-phase resolution of the query. Roots removed from the list will not be processed any further. Roots that remain on the candidates collection will be normally processed and fitting colliders will be evaluated in the query narrow-phase resolution. Hitbox collider indices added to the processed set will be evaluated in the narrow-phase regardless of further root processing steps (e.g. layer mask match). |
void PositionRotation | ( | Hitbox | hitbox, |
int | tick, | ||
out Vector3 | position, | ||
out Quaternion | rotation, | ||
bool | subtickAccuracy = false , |
||
int? | tickTo = null , |
||
float? | alpha = null |
||
) |
Performs a lag-compensated query for a specific Hitbox position and rotation.
hitbox | The target hitbox to be queried in the past |
tick | The tick to be queried |
tickTo | Simulation tick number to use as the time reference for the lag compensation. If provided, must be combined with the alpha parameter for interpolation between tick and tickTo . If subtickAccuracy is requested, the query will return the hitbox state interpolated between the specified ticks. Otherwise, only one of the two ticks will be considered, according to the rounded value of alpha . |
alpha | Interpolation value when querying between tick and tickTo . If subtickAccuracy is requested, the query will return the hitbox state interpolated between the specified ticks. Otherwise, only one of the two ticks will be considered, according to the rounded alpha value. |
position | Will be filled with the hitbox position at the time of the tick |
rotation | Will be filled with the hitbox rotation at the time of the tick |
subtickAccuracy | If the query should interpolate between ticks to reflect exactly what was seen on the client. |
void PositionRotation | ( | Hitbox | hitbox, |
PlayerRef | player, | ||
out Vector3 | position, | ||
out Quaternion | rotation, | ||
bool | subTickAccuracy = false |
||
) |
Performs a lag-compensated query for a specific Hitbox position and rotation.
hitbox | The target hitbox to be queried in the past |
player | Player who "owns" this overlap. Used by the server to find the exact hitbox snapshots to check against. |
position | Will be filled with the hitbox position at the time of the tick |
rotation | Will be filled with the hitbox rotation at the time of the tick |
subTickAccuracy | If the query should interpolate between ticks to reflect exactly what was seen on the client. |
bool Raycast | ( | RaycastQuery | query, |
out LagCompensatedHit | hit | ||
) |
Performs a lag-compensated raycast query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes.
query | The query containing all necessary information. |
hit | Raycast results will be filled in here. |
bool Raycast | ( | Vector3 | origin, |
Vector3 | direction, | ||
float | length, | ||
int | tick, | ||
int? | tickTo, | ||
float? | alpha, | ||
out LagCompensatedHit | hit, | ||
int | layerMask = -1 , |
||
HitOptions | options = HitOptions.None , |
||
QueryTriggerInteraction | queryTriggerInteraction = QueryTriggerInteraction.UseGlobal , |
||
PreProcessingDelegate | preProcessRoots = null |
||
) |
Performs a lag-compensated raycast query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes.
origin | Raycast origin, in world-space |
direction | Raycast direction, in world-space |
length | Raycast length |
tick | Simulation tick number to use as the time reference for the lag compensation (use this for server AI, and similar). |
tickTo | Simulation tick number to use as the time reference for the lag compensation. If provided, must be combined with the alpha parameter for interpolation between tick and tickTo . If HitOptions.SubtickAccuracy is included on options , this query will be resolved against hitbox colliders interpolated between the specified ticks. Otherwise, only one of the two ticks will be considered, according to the rounded value of alpha . |
alpha | Interpolation value when querying between tick and tickTo . If HitOptions.SubtickAccuracy is included on options , this query will be resolved against hitbox colliders interpolated between the specified ticks. Otherwise, only one of the two ticks will be considered, according to the rounded alpha value. |
hit | Raycast results will be filled in here. |
layerMask | Only objects with matching layers will be checked against. |
options | Opt-in flags to compute with sub-tick accuracy (HitOptions.SubtickAccuracy) and/or to include PhysX (HitOptions.IncludePhysX) or Box2D (HitOptions.IncludeBox2D). |
queryTriggerInteraction | Trigger interaction behavior when also querying PhysX. |
preProcessRoots | Delegate to pre-process HitboxRoots found in the broad-phase resolution of the query. Roots removed from the list will not be processed any further. Roots that remain on the candidates collection will be normally processed and fitting colliders will be evaluated in the query narrow-phase resolution. Hitbox collider indices added to the processed set will be evaluated in the narrow-phase regardless of further root processing steps (e.g. layer mask match). |
bool Raycast | ( | Vector3 | origin, |
Vector3 | direction, | ||
float | length, | ||
PlayerRef | player, | ||
out LagCompensatedHit | hit, | ||
int | layerMask = -1 , |
||
HitOptions | options = HitOptions.None , |
||
QueryTriggerInteraction | queryTriggerInteraction = QueryTriggerInteraction.UseGlobal , |
||
PreProcessingDelegate | preProcessRoots = null |
||
) |
Performs a lag-compensated raycast query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes.
origin | Raycast origin, in world-space |
direction | Raycast direction, in world-space |
length | Raycast length |
player | Player who "owns" this raycast. Used by the server to find the exact hitbox snapshots to check against. |
hit | Raycast results will be filled in here. |
layerMask | Only objects with matching layers will be checked against. |
options | Opt-in flags to compute with sub-tick accuracy (HitOptions.SubtickAccuracy) and/or to include PhysX (HitOptions.IncludePhysX) or Box2D (HitOptions.IncludeBox2D). |
queryTriggerInteraction | Trigger interaction behavior when also querying PhysX. |
preProcessRoots | Delegate to pre-process HitboxRoots found in the broad-phase resolution of the query. Roots removed from the list will not be processed any further. Roots that remain on the candidates collection will be normally processed and fitting colliders will be evaluated in the query narrow-phase resolution. Hitbox collider indices added to the processed set will be evaluated in the narrow-phase regardless of further root processing steps (e.g. layer mask match). |
int RaycastAll | ( | RaycastAllQuery | query, |
List< LagCompensatedHit > | hits, | ||
bool | clearHits = true |
||
) |
Performs a lag-compensated raycast query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes.
query | The query containing all necessary information. |
hits | List to be filled with hits (both hitboxes and/or static colliders, if included). |
clearHits | Clear list of hits before filling with new ones (defaults to true). |
int RaycastAll | ( | Vector3 | origin, |
Vector3 | direction, | ||
float | length, | ||
int | tick, | ||
int? | tickTo, | ||
float? | alpha, | ||
List< LagCompensatedHit > | hits, | ||
int | layerMask = -1 , |
||
bool | clearHits = true , |
||
HitOptions | options = HitOptions.None , |
||
QueryTriggerInteraction | queryTriggerInteraction = QueryTriggerInteraction.UseGlobal , |
||
PreProcessingDelegate | preProcessRoots = null |
||
) |
Performs a lag-compensated raycast query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. Important: results are NOT sorted by distance.
origin | Raycast origin, in world-space |
direction | Raycast direction, in world-space |
length | Raycast length |
tick | Simulation tick number to use as the time reference for the lag compensation (use this for server AI, and similar). |
tickTo | Simulation tick number to use as the time reference for the lag compensation. If provided, must be combined with the alpha parameter for interpolation between tick and tickTo . If HitOptions.SubtickAccuracy is included on options , this query will be resolved against hitbox colliders interpolated between the specified ticks. Otherwise, only one of the two ticks will be considered, according to the rounded value of alpha . |
alpha | Interpolation value when querying between tick and tickTo . If HitOptions.SubtickAccuracy is included on options , this query will be resolved against hitbox colliders interpolated between the specified ticks. Otherwise, only one of the two ticks will be considered, according to the rounded alpha value. |
hits | List to be filled with hits (both hitboxes and/or static colliders, if included). |
layerMask | Only objects with matching layers will be checked against. |
options | Opt-in flags to compute with sub-tick accuracy (HitOptions.SubtickAccuracy) and/or to include PhysX (HitOptions.IncludePhysX) or Box2D (HitOptions.IncludeBox2D). |
clearHits | Clear list of hits before filling with new ones (defaults to true). |
queryTriggerInteraction | Trigger interaction behavior when also querying PhysX. |
preProcessRoots | Delegate to pre-process HitboxRoots found in the broad-phase resolution of the query. Roots removed from the list will not be processed any further. Roots that remain on the candidates collection will be normally processed and fitting colliders will be evaluated in the query narrow-phase resolution. Hitbox collider indices added to the processed set will be evaluated in the narrow-phase regardless of further root processing steps (e.g. layer mask match). |
int RaycastAll | ( | Vector3 | origin, |
Vector3 | direction, | ||
float | length, | ||
PlayerRef | player, | ||
List< LagCompensatedHit > | hits, | ||
int | layerMask = -1 , |
||
bool | clearHits = true , |
||
HitOptions | options = HitOptions.None , |
||
QueryTriggerInteraction | queryTriggerInteraction = QueryTriggerInteraction.UseGlobal , |
||
PreProcessingDelegate | preProcessRoots = null |
||
) |
Performs a lag-compensated raycast query against all registered hitboxes. If the HitOptions.IncludePhysX or HitOptions.IncludeBox2D flag is indicated, query will also include static colliders, Unity colliders are recommended for static geometry, rather than Hitboxes. Important: results are NOT sorted by distance.
origin | Raycast origin, in world-space |
direction | Raycast direction, in world-space |
length | Raycast length |
player | Player who "owns" this raycast. Used by the server to find the exact hitbox snapshots to check against. |
hits | List to be filled with hits (both hitboxes and/or static colliders, if included). |
layerMask | Only objects with matching layers will be checked against. |
options | Opt-in flags to compute with sub-tick accuracy (HitOptions.SubtickAccuracy) and/or to include PhysX (HitOptions.IncludePhysX) or Box2D (HitOptions.IncludeBox2D). |
clearHits | Clear list of hits before filling with new ones (defaults to true). |
queryTriggerInteraction | Trigger interaction behavior when also querying PhysX. |
preProcessRoots | Delegate to pre-process HitboxRoots found in the broad-phase resolution of the query. Roots removed from the list will not be processed any further. Roots that remain on the candidates collection will be normally processed and fitting colliders will be evaluated in the query narrow-phase resolution. Hitbox collider indices added to the processed set will be evaluated in the narrow-phase regardless of further root processing steps (e.g. layer mask match). |
int BVHDepth |
Debug data from Broadphase BVH (tree depth).
int BVHNodes |
Debug data from Broadphase BVH (total nodes count).
LagCompensationDraw DrawInfo |
Debug data used to draw the BVH nodes and the lag compensation history.
int TotalHitboxes |
Debug data from lag compensation history (registered Hitbox count).