Table of Contents

Class LagCompensation

Namespace
Netick
Assembly
NetickPremium.dll
[ExecutionOrder(1500)]
public sealed class LagCompensation : NetickCoreComponent, ResetOnSceneSwitch
Inheritance
Object
Component
Behaviour
MonoBehaviour
LagCompensation
Implements
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.useGUILayout
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.transform
Component.gameObject
Component.tag
Object.GetInstanceID()
Object.GetHashCode()
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectOfType<T>()
Object.ToString()
Object.name
Object.hideFlags

Constructors

LagCompensation()

public LagCompensation()

Fields

Compensate

public bool Compensate

Field Value

bool

Methods

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

public void FetchHitShapePosAndRot(HitShape hitshape, NetworkPlayer inputSource, out Vector3 pos, out Quaternion rot)

Parameters

hitshape HitShape
inputSource NetworkPlayer
pos Vector3
rot Quaternion

NetworkFixedUpdate()

Called every fixed-time network update/tick. Any changes/updates to the network state must happen here.

On the client, if you are the Input Source or if this Object.PredictionMode is set to Everyone, it will be called several times in one update/tick during resimulations. To check for resimulations, use [IsResimulating].

public override void NetworkFixedUpdate()

NetworkRender()

Called every frame. Executed after NetworkUpdate and NetworkFixedUpdate.

IMPORTANT NOTE: properties (which can be interpolated) marked with [Smooth] attribute will return interpolated values when accessed in this method.

public override void NetworkRender()

OverlapSphere(Vector3, float, List<NetHit>, NetworkPlayer, int, QueryTriggerInteraction, bool, bool, bool)

Performs a lag compensated OverlapSphere which computes and stores HitShapes and Colliders (if includeUnityColliders is equal to true) touching or inside the sphere.

public void OverlapSphere(Vector3 center, float radius, List<NetHit> hits, NetworkPlayer inputSource, int layerMask = -5, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal, bool includeUnityColliders = true, bool includeInputSource = false, bool oneHitPerHitshapeContainer = false)

Parameters

center Vector3

Center of the sphere.

radius float

Radius of the sphere.

hits List<NetHit>
inputSource NetworkPlayer

The input source to compensate for.

layerMask int

A defines which layers of colliders to include in the query.

queryTriggerInteraction QueryTriggerInteraction
includeUnityColliders bool

Choose whether you want to include normal unity colliders, or only Netick HitShapes.

includeInputSource bool
oneHitPerHitshapeContainer bool

Choose whether you want to include only one HitShape per HitShapeContainer

Raycast(Vector3, Vector3, out NetHit, NetworkPlayer, float, int, QueryTriggerInteraction, bool, bool)

Casts a lag compensated ray, from point origin, in direction direction, of length maxDistance, against all HitShapes and Colliders (if includeUnityColliders is equal to true) in the Scene.

public bool Raycast(Vector3 origin, Vector3 direction, out NetHit hitData, NetworkPlayer inputSource, float maxDistance = Infinity, int layerMask = -5, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal, bool includeUnityColliders = true, bool includeInputSource = false)

Parameters

origin Vector3

The starting point of the ray in world coordinates.

direction Vector3

The direction of the ray.

hitData NetHit
inputSource NetworkPlayer

The input source to compensate for.

maxDistance float

The max distance the ray should check for collisions.

layerMask int

A that is used to selectively ignore Colliders when casting a ray.

queryTriggerInteraction QueryTriggerInteraction
includeUnityColliders bool

Choose whether you want to include normal unity colliders, or only Netick HitShapes.

includeInputSource bool

Returns

bool

Returns true if the ray intersects with a Collider/HitShape, otherwise false.