Class NetworkSandboxExts
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
sandboxNetworkSandboxThe network sandbox.
hitShapeHitShapeThe HitShape to sample.
inputSourceNetworkPlayerThe player to rewind for.
posVector3The rewound world position of the shape's center.
rotQuaternionThe 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
sandboxNetworkSandboxThe network sandbox.
centerVector2Circle center, in world space (XY).
radiusfloatCircle radius.
hitsList<LagCompHit2D>Destination list. Cleared, then filled with every overlap (unordered).
inputSourceNetworkPlayerThe player to rewind for.
layerMaskintLayer mask applied to both HitShapes and Unity 2D colliders.
includeUnityCollidersboolWhen true, also appends overlapping Unity 2D colliders.
includeInputSourceboolWhen false, the input source's own HitShapes are skipped.
oneHitPerHitShapeContainerboolWhen true, at most one HitShape hit is reported per container.
filterPredicate<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
sandboxNetworkSandboxThe network sandbox.
centerVector3Sphere center, in world space.
radiusfloatSphere radius.
hitsList<LagCompHit>Destination list. Cleared, then filled with every overlap (unordered).
inputSourceNetworkPlayerThe player to rewind for.
layerMaskintLayer mask applied to both HitShapes and Unity colliders.
queryTriggerInteractionQueryTriggerInteractionHow the Unity collider pass treats trigger colliders.
includeUnityCollidersboolWhen true, also appends overlapping Unity colliders.
includeInputSourceboolWhen false, the input source's own HitShapes are skipped.
oneHitPerHitShapeContainerboolWhen true, at most one HitShape hit is reported per container.
filterPredicate<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
sandboxNetworkSandboxThe network sandbox.
originVector3Ray start, in world space.
directionVector3Ray direction. Need not be normalized.
hitDataLagCompHitThe closest hit, when the method returns true.
inputSourceNetworkPlayerThe player to rewind for — pass the shooting player's input source.
maxDistancefloatMaximum ray length.
layerMaskintLayer mask applied to both HitShapes and Unity colliders.
queryTriggerInteractionQueryTriggerInteractionHow the Unity collider pass treats trigger colliders.
includeUnityCollidersboolWhen true, also raycasts Unity physics and merges the result by distance.
includeInputSourceboolWhen false, the input source's own HitShapes are skipped.
filterPredicate<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
sandboxNetworkSandboxThe network sandbox.
originVector2Ray start, in world space (XY).
directionVector2Ray direction. Need not be normalized.
hitDataLagCompHit2DThe closest hit, when the method returns true.
inputSourceNetworkPlayerThe player to rewind for.
maxDistancefloatMaximum ray length.
layerMaskintLayer mask applied to both HitShapes and Unity 2D colliders.
includeUnityCollidersboolWhen true, also raycasts Unity 2D physics and merges the result by distance.
includeInputSourceboolWhen false, the input source's own HitShapes are skipped.
filterPredicate<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
sandboxNetworkSandboxThe network sandbox.
originVector3Ray start, in world space.
directionVector3Ray direction. Need not be normalized.
hitsList<LagCompHit>Destination list. Cleared, then filled with every hit (unordered).
inputSourceNetworkPlayerThe player to rewind for.
maxDistancefloatMaximum ray length.
layerMaskintLayer mask applied to both HitShapes and Unity colliders.
queryTriggerInteractionQueryTriggerInteractionHow the Unity collider pass treats trigger colliders.
includeUnityCollidersboolWhen true, also appends Unity physics hits.
includeInputSourceboolWhen false, the input source's own HitShapes are skipped.
oneHitPerHitShapeContainerboolWhen true, at most one HitShape hit is reported per container.
filterPredicate<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
sandboxNetworkSandboxThe network sandbox.
originVector2Ray start, in world space (XY).
directionVector2Ray direction. Need not be normalized.
hitsList<LagCompHit2D>Destination list. Cleared, then filled with every hit (unordered).
inputSourceNetworkPlayerThe player to rewind for.
maxDistancefloatMaximum ray length.
layerMaskintLayer mask applied to both HitShapes and Unity 2D colliders.
includeUnityCollidersboolWhen true, also appends Unity 2D physics hits.
includeInputSourceboolWhen false, the input source's own HitShapes are skipped.
oneHitPerHitShapeContainerboolWhen true, at most one HitShape hit is reported per container.
filterPredicate<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
sandboxNetworkSandboxThe network sandbox.
originVector3Center of the sphere at the start of the sweep, in world space.
radiusfloatSphere radius.
directionVector3Sweep direction. Need not be normalized.
hitDataLagCompHitThe closest hit, when the method returns true.
inputSourceNetworkPlayerThe player to rewind for.
maxDistancefloatMaximum sweep distance.
layerMaskintLayer mask applied to both HitShapes and Unity colliders.
queryTriggerInteractionQueryTriggerInteractionHow the Unity collider pass treats trigger colliders.
includeUnityCollidersboolWhen true, also sphere-casts Unity physics and merges the result by distance.
includeInputSourceboolWhen false, the input source's own HitShapes are skipped.
filterPredicate<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
sandboxNetworkSandboxThe network sandbox.
originVector3Center of the sphere at the start of the sweep, in world space.
radiusfloatSphere radius.
directionVector3Sweep direction. Need not be normalized.
hitsList<LagCompHit>Destination list. Cleared, then filled with every hit (unordered).
inputSourceNetworkPlayerThe player to rewind for.
maxDistancefloatMaximum sweep distance.
layerMaskintLayer mask applied to both HitShapes and Unity colliders.
queryTriggerInteractionQueryTriggerInteractionHow the Unity collider pass treats trigger colliders.
includeUnityCollidersboolWhen true, also appends Unity physics hits.
includeInputSourceboolWhen false, the input source's own HitShapes are skipped.
oneHitPerHitShapeContainerboolWhen true, at most one HitShape hit is reported per container.
filterPredicate<LagCompFilterData>Optional predicate to reject candidate containers before testing.