This commit is contained in:
mischa 2024-01-10 15:25:29 +01:00
parent 13aa0c2e6b
commit 9aadcbf442

View File

@ -221,24 +221,6 @@ void FixedUpdate()
if (isClient) RecordState();
}
void ApplyState(Vector3 position, Quaternion rotation, Vector3 velocity)
{
// Rigidbody .position teleports, while .MovePosition interpolates
// TODO is this a good idea? what about next capture while it's interpolating?
if (correctionMode == CorrectionMode.Move)
{
rb.MovePosition(position);
rb.MoveRotation(rotation);
}
else if (correctionMode == CorrectionMode.Set)
{
rb.position = position;
rb.rotation = rotation;
}
rb.velocity = velocity;
}
// manually store last recorded so we can easily check against this
// without traversing the SortedList.
RigidbodyState lastRecorded;
@ -289,6 +271,24 @@ void RecordState()
lastRecorded = state;
}
void ApplyState(Vector3 position, Quaternion rotation, Vector3 velocity)
{
// Rigidbody .position teleports, while .MovePosition interpolates
// TODO is this a good idea? what about next capture while it's interpolating?
if (correctionMode == CorrectionMode.Move)
{
rb.MovePosition(position);
rb.MoveRotation(rotation);
}
else if (correctionMode == CorrectionMode.Set)
{
rb.position = position;
rb.rotation = rotation;
}
rb.velocity = velocity;
}
void ApplyCorrection(RigidbodyState corrected, RigidbodyState before, RigidbodyState after)
{
// TODO merge this with CompareState iteration!