Table of Contents

Class NetworkSandboxExts

Namespace
Netick.Unity.Pro
Assembly
Netick.Unity.Pro.dll
public static class NetworkSandboxExts
Inheritance
NetworkSandboxExts
Inherited Members

Methods

FetchHitShapePosAndRot(NetworkSandbox, HitShape, NetworkPlayer, out Vector3, out Quaternion)

Returns the lag-compensated world position and rotation of a HitShape as the inputSource perceived it - the same rewound, interpolated pose a query for that player tests against. Falls back to the live transform if lag compensation isn't enabled.

public static void FetchHitShapePosAndRot(this NetworkSandbox sandbox, HitShape hitShape, NetworkPlayer inputSource, out Vector3 pos, out Quaternion rot)

Parameters

sandbox NetworkSandbox

The network sandbox.

hitShape HitShape

The HitShape to sample.

inputSource NetworkPlayer

The player to rewind for.

pos Vector3

The rewound world position of the shape's center.

rot Quaternion

The rewound world rotation of the shape.

OverlapCircle(NetworkSandbox, Vector2, float, List<LagCompHit2D>, NetworkPlayer, int, bool, bool, bool, Predicate<LagCompFilterData>)

2D variant of OverlapSphere(NetworkSandbox, Vector3, float, List<LagCompHit>, NetworkPlayer, int, QueryTriggerInteraction, bool, bool, bool, Predicate<LagCompFilterData>). Collects every lag-compensated HitShape overlapping a circle on the XY plane into hits (cleared first), plus optionally overlapping Unity 2D colliders.

public static void OverlapCircle(this NetworkSandbox sandbox, Vector2 center, float radius, List<LagCompHit2D> hits, NetworkPlayer inputSource, int layerMask = -5, bool includeUnityColliders = true, bool includeInputSource = false, bool oneHitPerHitShapeContainer = false, Predicate<LagCompFilterData> filter = null)

Parameters

sandbox NetworkSandbox

The network sandbox.

center Vector2

Circle center, in world space (XY).

radius float

Circle radius.

hits List<LagCompHit2D>

Destination list. Cleared, then filled with every overlap (unordered).

inputSource NetworkPlayer

The player to rewind for.

layerMask int

Layer mask applied to both HitShapes and Unity 2D colliders.

includeUnityColliders bool

When true, also appends overlapping Unity 2D colliders.

includeInputSource bool

When false, the input source's own HitShapes are skipped.

oneHitPerHitShapeContainer bool

When true, at most one HitShape hit is reported per container.

filter Predicate<LagCompFilterData>

Optional predicate to reject candidate containers before testing.

OverlapSphere(NetworkSandbox, Vector3, float, List<LagCompHit>, NetworkPlayer, int, QueryTriggerInteraction, bool, bool, bool, Predicate<LagCompFilterData>)

Collects every lag-compensated HitShape overlapping a sphere into hits (cleared first), plus optionally overlapping Unity colliders.

public static void OverlapSphere(this NetworkSandbox sandbox, Vector3 center, float radius, List<LagCompHit> hits, NetworkPlayer inputSource, int layerMask = -5, QueryTriggerInteraction queryTriggerInteraction = 0, bool includeUnityColliders = true, bool includeInputSource = false, bool oneHitPerHitShapeContainer = false, Predicate<LagCompFilterData> filter = null)

Parameters

sandbox NetworkSandbox

The network sandbox.

center Vector3

Sphere center, in world space.

radius float

Sphere radius.

hits List<LagCompHit>

Destination list. Cleared, then filled with every overlap (unordered).

inputSource NetworkPlayer

The player to rewind for.

layerMask int

Layer mask applied to both HitShapes and Unity colliders.

queryTriggerInteraction QueryTriggerInteraction

How the Unity collider pass treats trigger colliders.

includeUnityColliders bool

When true, also appends overlapping Unity colliders.

includeInputSource bool

When false, the input source's own HitShapes are skipped.

oneHitPerHitShapeContainer bool

When true, at most one HitShape hit is reported per container.

filter Predicate<LagCompFilterData>

Optional predicate to reject candidate containers before testing.

Raycast(NetworkSandbox, Vector3, Vector3, out LagCompHit, NetworkPlayer, float, int, QueryTriggerInteraction, bool, bool, Predicate<LagCompFilterData>)

Casts a lag-compensated ray and returns the closest hit across both Netick HitShapes (rewound for inputSource) and, optionally, Unity colliders. When both are hit, the nearer one wins.

public static bool Raycast(this NetworkSandbox sandbox, Vector3 origin, Vector3 direction, out LagCompHit hitData, NetworkPlayer inputSource, float maxDistance = Infinity, int layerMask = -5, QueryTriggerInteraction queryTriggerInteraction = 0, bool includeUnityColliders = true, bool includeInputSource = false, Predicate<LagCompFilterData> filter = null)

Parameters

sandbox NetworkSandbox

The network sandbox.

origin Vector3

Ray start, in world space.

direction Vector3

Ray direction. Need not be normalized.

hitData LagCompHit

The closest hit, when the method returns true.

inputSource NetworkPlayer

The player to rewind for — pass the shooting player's input source.

maxDistance float

Maximum ray length.

layerMask int

Layer mask applied to both HitShapes and Unity colliders.

queryTriggerInteraction QueryTriggerInteraction

How the Unity collider pass treats trigger colliders.

includeUnityColliders bool

When true, also raycasts Unity physics and merges the result by distance.

includeInputSource bool

When false, the input source's own HitShapes are skipped.

filter Predicate<LagCompFilterData>

Optional predicate to reject candidate containers before testing.

Returns

bool

True if either a HitShape or a Unity collider was hit.

Raycast2D(NetworkSandbox, Vector2, Vector2, out LagCompHit2D, NetworkPlayer, float, int, bool, bool, Predicate<LagCompFilterData>)

2D variant of Raycast(NetworkSandbox, Vector3, Vector3, out LagCompHit, NetworkPlayer, float, int, QueryTriggerInteraction, bool, bool, Predicate<LagCompFilterData>). Casts on the XY plane against lag-compensated HitShapes and, optionally, Unity 2D colliders, returning the closest hit.

public static bool Raycast2D(this NetworkSandbox sandbox, Vector2 origin, Vector2 direction, out LagCompHit2D hitData, NetworkPlayer inputSource, float maxDistance = Infinity, int layerMask = -5, bool includeUnityColliders = true, bool includeInputSource = false, Predicate<LagCompFilterData> filter = null)

Parameters

sandbox NetworkSandbox

The network sandbox.

origin Vector2

Ray start, in world space (XY).

direction Vector2

Ray direction. Need not be normalized.

hitData LagCompHit2D

The closest hit, when the method returns true.

inputSource NetworkPlayer

The player to rewind for.

maxDistance float

Maximum ray length.

layerMask int

Layer mask applied to both HitShapes and Unity 2D colliders.

includeUnityColliders bool

When true, also raycasts Unity 2D physics and merges the result by distance.

includeInputSource bool

When false, the input source's own HitShapes are skipped.

filter Predicate<LagCompFilterData>

Optional predicate to reject candidate containers before testing.

Returns

bool

True if either a HitShape or a Unity 2D collider was hit.

RaycastAll(NetworkSandbox, Vector3, Vector3, List<LagCompHit>, NetworkPlayer, float, int, QueryTriggerInteraction, bool, bool, bool, Predicate<LagCompFilterData>)

Casts a lag-compensated ray and collects all hits into hits (cleared first), across both Netick HitShapes (rewound for inputSource) and, optionally, Unity colliders.

public static void RaycastAll(this NetworkSandbox sandbox, Vector3 origin, Vector3 direction, List<LagCompHit> hits, NetworkPlayer inputSource, float maxDistance = Infinity, int layerMask = -5, QueryTriggerInteraction queryTriggerInteraction = 0, bool includeUnityColliders = true, bool includeInputSource = false, bool oneHitPerHitShapeContainer = false, Predicate<LagCompFilterData> filter = null)

Parameters

sandbox NetworkSandbox

The network sandbox.

origin Vector3

Ray start, in world space.

direction Vector3

Ray direction. Need not be normalized.

hits List<LagCompHit>

Destination list. Cleared, then filled with every hit (unordered).

inputSource NetworkPlayer

The player to rewind for.

maxDistance float

Maximum ray length.

layerMask int

Layer mask applied to both HitShapes and Unity colliders.

queryTriggerInteraction QueryTriggerInteraction

How the Unity collider pass treats trigger colliders.

includeUnityColliders bool

When true, also appends Unity physics hits.

includeInputSource bool

When false, the input source's own HitShapes are skipped.

oneHitPerHitShapeContainer bool

When true, at most one HitShape hit is reported per container.

filter Predicate<LagCompFilterData>

Optional predicate to reject candidate containers before testing.

RaycastAll2D(NetworkSandbox, Vector2, Vector2, List<LagCompHit2D>, NetworkPlayer, float, int, bool, bool, bool, Predicate<LagCompFilterData>)

2D variant of RaycastAll(NetworkSandbox, Vector3, Vector3, List<LagCompHit>, NetworkPlayer, float, int, QueryTriggerInteraction, bool, bool, bool, Predicate<LagCompFilterData>). Casts on the XY plane and collects all hits into hits (cleared first) across lag-compensated HitShapes and, optionally, Unity 2D colliders.

public static void RaycastAll2D(this NetworkSandbox sandbox, Vector2 origin, Vector2 direction, List<LagCompHit2D> hits, NetworkPlayer inputSource, float maxDistance = Infinity, int layerMask = -5, bool includeUnityColliders = true, bool includeInputSource = false, bool oneHitPerHitShapeContainer = false, Predicate<LagCompFilterData> filter = null)

Parameters

sandbox NetworkSandbox

The network sandbox.

origin Vector2

Ray start, in world space (XY).

direction Vector2

Ray direction. Need not be normalized.

hits List<LagCompHit2D>

Destination list. Cleared, then filled with every hit (unordered).

inputSource NetworkPlayer

The player to rewind for.

maxDistance float

Maximum ray length.

layerMask int

Layer mask applied to both HitShapes and Unity 2D colliders.

includeUnityColliders bool

When true, also appends Unity 2D physics hits.

includeInputSource bool

When false, the input source's own HitShapes are skipped.

oneHitPerHitShapeContainer bool

When true, at most one HitShape hit is reported per container.

filter Predicate<LagCompFilterData>

Optional predicate to reject candidate containers before testing.

SphereCast(NetworkSandbox, Vector3, float, Vector3, out LagCompHit, NetworkPlayer, float, int, QueryTriggerInteraction, bool, bool, Predicate<LagCompFilterData>)

Sweeps a lag-compensated sphere of radius along a ray and returns the closest hit across both Netick HitShapes (rewound for inputSource) and, optionally, Unity colliders.

public static bool SphereCast(this NetworkSandbox sandbox, Vector3 origin, float radius, Vector3 direction, out LagCompHit hitData, NetworkPlayer inputSource, float maxDistance = Infinity, int layerMask = -5, QueryTriggerInteraction queryTriggerInteraction = 0, bool includeUnityColliders = true, bool includeInputSource = false, Predicate<LagCompFilterData> filter = null)

Parameters

sandbox NetworkSandbox

The network sandbox.

origin Vector3

Center of the sphere at the start of the sweep, in world space.

radius float

Sphere radius.

direction Vector3

Sweep direction. Need not be normalized.

hitData LagCompHit

The closest hit, when the method returns true.

inputSource NetworkPlayer

The player to rewind for.

maxDistance float

Maximum sweep distance.

layerMask int

Layer mask applied to both HitShapes and Unity colliders.

queryTriggerInteraction QueryTriggerInteraction

How the Unity collider pass treats trigger colliders.

includeUnityColliders bool

When true, also sphere-casts Unity physics and merges the result by distance.

includeInputSource bool

When false, the input source's own HitShapes are skipped.

filter Predicate<LagCompFilterData>

Optional predicate to reject candidate containers before testing.

Returns

bool

True if either a HitShape or a Unity collider was hit.

SphereCastAll(NetworkSandbox, Vector3, float, Vector3, List<LagCompHit>, NetworkPlayer, float, int, QueryTriggerInteraction, bool, bool, bool, Predicate<LagCompFilterData>)

Sweeps a lag-compensated sphere of radius along a ray and collects all hits into hits (cleared first), across both Netick HitShapes (rewound for inputSource) and, optionally, Unity colliders.

public static void SphereCastAll(this NetworkSandbox sandbox, Vector3 origin, float radius, Vector3 direction, List<LagCompHit> hits, NetworkPlayer inputSource, float maxDistance = Infinity, int layerMask = -5, QueryTriggerInteraction queryTriggerInteraction = 0, bool includeUnityColliders = true, bool includeInputSource = false, bool oneHitPerHitShapeContainer = false, Predicate<LagCompFilterData> filter = null)

Parameters

sandbox NetworkSandbox

The network sandbox.

origin Vector3

Center of the sphere at the start of the sweep, in world space.

radius float

Sphere radius.

direction Vector3

Sweep direction. Need not be normalized.

hits List<LagCompHit>

Destination list. Cleared, then filled with every hit (unordered).

inputSource NetworkPlayer

The player to rewind for.

maxDistance float

Maximum sweep distance.

layerMask int

Layer mask applied to both HitShapes and Unity colliders.

queryTriggerInteraction QueryTriggerInteraction

How the Unity collider pass treats trigger colliders.

includeUnityColliders bool

When true, also appends Unity physics hits.

includeInputSource bool

When false, the input source's own HitShapes are skipped.

oneHitPerHitShapeContainer bool

When true, at most one HitShape hit is reported per container.

filter Predicate<LagCompFilterData>

Optional predicate to reject candidate containers before testing.