perf: Changed not virtual and inline

This commit is contained in:
mischa 2024-10-17 11:38:02 +02:00
parent 1ef00f9d44
commit 5efba8b923

View File

@ -197,7 +197,8 @@ protected virtual void ApplySnapshot(TransformSnapshot interpolated)
// check if position / rotation / scale changed since last _full reliable_ sync. // check if position / rotation / scale changed since last _full reliable_ sync.
// squared comparisons for performance // squared comparisons for performance
protected virtual bool Changed(TransformSnapshot current) [MethodImpl(MethodImplOptions.AggressiveInlining)]
bool Changed(TransformSnapshot current)
{ {
// if (syncPosition && Vector3.Distance(last.position, current.position) >= positionPrecision) // if (syncPosition && Vector3.Distance(last.position, current.position) >= positionPrecision)
if (syncPosition && (current.position - last.position).sqrMagnitude >= positionPrecisionSqr) if (syncPosition && (current.position - last.position).sqrMagnitude >= positionPrecisionSqr)