mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
syntax
This commit is contained in:
parent
13aa0c2e6b
commit
9aadcbf442
@ -221,24 +221,6 @@ void FixedUpdate()
|
|||||||
if (isClient) RecordState();
|
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
|
// manually store last recorded so we can easily check against this
|
||||||
// without traversing the SortedList.
|
// without traversing the SortedList.
|
||||||
RigidbodyState lastRecorded;
|
RigidbodyState lastRecorded;
|
||||||
@ -289,6 +271,24 @@ void RecordState()
|
|||||||
lastRecorded = state;
|
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)
|
void ApplyCorrection(RigidbodyState corrected, RigidbodyState before, RigidbodyState after)
|
||||||
{
|
{
|
||||||
// TODO merge this with CompareState iteration!
|
// TODO merge this with CompareState iteration!
|
||||||
|
Loading…
Reference in New Issue
Block a user