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;
|
rb.velocity = velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// compare client state with server state at timestamp.
|
// process a received server state.
|
||||||
// apply correction if necessary.
|
// compares it against our history and applies corrections if needed.
|
||||||
void CompareState(double timestamp, RigidbodyState state)
|
void OnReceivedState(double timestamp, RigidbodyState state)
|
||||||
{
|
{
|
||||||
// OPTIONAL performance optimization when comparing idle objects.
|
// OPTIONAL performance optimization when comparing idle objects.
|
||||||
// even idle objects will have a history of ~32 entries.
|
// 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 this ever causes issues, feel free to disable it.
|
||||||
if (compareLastFirst && Vector3.Distance(state.position, rb.position) < correctionThreshold)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,8 +467,8 @@ public override void OnDeserialize(NetworkReader reader, bool initialState)
|
|||||||
Quaternion rotation = reader.ReadQuaternion();
|
Quaternion rotation = reader.ReadQuaternion();
|
||||||
Vector3 velocity = reader.ReadVector3();
|
Vector3 velocity = reader.ReadVector3();
|
||||||
|
|
||||||
// compare state without deltas
|
// process received state
|
||||||
CompareState(timestamp, new RigidbodyState(timestamp, Vector3.zero, position, rotation, Vector3.zero, velocity));
|
OnReceivedState(timestamp, new RigidbodyState(timestamp, Vector3.zero, position, rotation, Vector3.zero, velocity));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnValidate()
|
protected override void OnValidate()
|
||||||
|
Loading…
Reference in New Issue
Block a user