Class LagCompensation
- Namespace
- Netick
- Assembly
- NetickPremium.dll
[ExecutionOrder(1500)]
public sealed class LagCompensation : NetickCoreComponent, ResetOnSceneSwitch
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourLagCompensation
- Implements
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.useGUILayoutMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.transformComponent.gameObjectComponent.tagObject.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.nameObject.hideFlags
Constructors
LagCompensation()
public LagCompensation()
Fields
Compensate
public bool Compensate
Field Value
Methods
FetchHitShapePosAndRot(HitShape, NetworkPlayer, out Vector3, out Quaternion)
public void FetchHitShapePosAndRot(HitShape hitshape, NetworkPlayer inputSource, out Vector3 pos, out Quaternion rot)
Parameters
hitshape
HitShapeinputSource
NetworkPlayerpos
Vector3rot
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
Vector3Center of the sphere.
radius
floatRadius of the sphere.
hits
List<NetHit>inputSource
NetworkPlayerThe input source to compensate for.
layerMask
intA defines which layers of colliders to include in the query.
queryTriggerInteraction
QueryTriggerInteractionincludeUnityColliders
boolChoose whether you want to include normal unity colliders, or only Netick HitShapes.
includeInputSource
booloneHitPerHitshapeContainer
boolChoose 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
Vector3The starting point of the ray in world coordinates.
direction
Vector3The direction of the ray.
hitData
NetHitinputSource
NetworkPlayerThe input source to compensate for.
maxDistance
floatThe max distance the ray should check for collisions.
layerMask
intA that is used to selectively ignore Colliders when casting a ray.
queryTriggerInteraction
QueryTriggerInteractionincludeUnityColliders
boolChoose 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.