mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 19:10:32 +00:00
perf: PredictedRigidbody RecordState only grabs count once
This commit is contained in:
parent
2ecafaa634
commit
0657da87ea
@ -508,9 +508,10 @@ void RecordState()
|
|||||||
Vector3 velocityDelta = Vector3.zero;
|
Vector3 velocityDelta = Vector3.zero;
|
||||||
Vector3 angularVelocityDelta = Vector3.zero;
|
Vector3 angularVelocityDelta = Vector3.zero;
|
||||||
Quaternion rotationDelta = Quaternion.identity;
|
Quaternion rotationDelta = Quaternion.identity;
|
||||||
if (stateHistory.Count > 0)
|
int stateHistoryCount = stateHistory.Count; // perf: only grab .Count once
|
||||||
|
if (stateHistoryCount > 0)
|
||||||
{
|
{
|
||||||
RigidbodyState last = stateHistory.Values[stateHistory.Count - 1];
|
RigidbodyState last = stateHistory.Values[stateHistoryCount - 1];
|
||||||
positionDelta = currentPosition - last.position;
|
positionDelta = currentPosition - last.position;
|
||||||
velocityDelta = currentVelocity - last.velocity;
|
velocityDelta = currentVelocity - last.velocity;
|
||||||
// Quaternions always need to be normalized in order to be valid rotations after operations
|
// Quaternions always need to be normalized in order to be valid rotations after operations
|
||||||
|
Loading…
Reference in New Issue
Block a user