mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Prediction: CompareState renamed to OnReceivedState
This commit is contained in:
parent
eab82ee465
commit
0fd342e6a9
@ -303,9 +303,9 @@ void ApplyState(Vector3 position, Quaternion rotation, Vector3 velocity)
|
||||
rb.velocity = velocity;
|
||||
}
|
||||
|
||||
// compare client state with server state at timestamp.
|
||||
// apply correction if necessary.
|
||||
void CompareState(double timestamp, RigidbodyState state)
|
||||
// process a received server state.
|
||||
// compares it against our history and applies corrections if needed.
|
||||
void OnReceivedState(double timestamp, RigidbodyState state)
|
||||
{
|
||||
// OPTIONAL performance optimization when comparing idle objects.
|
||||
// even idle objects will have a history of ~32 entries.
|
||||
@ -327,7 +327,7 @@ void CompareState(double timestamp, RigidbodyState state)
|
||||
// if this ever causes issues, feel free to disable it.
|
||||
if (compareLastFirst && Vector3.Distance(state.position, rb.position) < correctionThreshold)
|
||||
{
|
||||
// Debug.Log($"CompareState for {name}: taking optimized early return!");
|
||||
// Debug.Log($"OnReceivedState for {name}: taking optimized early return!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -467,8 +467,8 @@ public override void OnDeserialize(NetworkReader reader, bool initialState)
|
||||
Quaternion rotation = reader.ReadQuaternion();
|
||||
Vector3 velocity = reader.ReadVector3();
|
||||
|
||||
// compare state without deltas
|
||||
CompareState(timestamp, new RigidbodyState(timestamp, Vector3.zero, position, rotation, Vector3.zero, velocity));
|
||||
// process received state
|
||||
OnReceivedState(timestamp, new RigidbodyState(timestamp, Vector3.zero, position, rotation, Vector3.zero, velocity));
|
||||
}
|
||||
|
||||
protected override void OnValidate()
|
||||
|
Loading…
Reference in New Issue
Block a user