Skip to content

Commit 283e2e8

Browse files
fix
Updating the approximation approach to yield a more precise end result.
1 parent 9e9172f commit 283e2e8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

com.unity.netcode.gameobjects/Runtime/Components/Interpolator/BufferedLinearInterpolatorVector3.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Runtime.CompilerServices;
23
using UnityEngine;
34

@@ -60,7 +61,9 @@ protected internal override Vector3 OnConvertTransformSpace(Transform transform,
6061
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6162
private protected override bool IsAproximately(Vector3 first, Vector3 second, float precision = 0.0001F)
6263
{
63-
return Vector3.Distance(first, second) <= precision;
64+
return Math.Round(Mathf.Abs(first.x - second.x), 2) <= precision &&
65+
Math.Round(Mathf.Abs(first.y - second.y), 2) <= precision &&
66+
Math.Round(Mathf.Abs(first.z - second.z), 2) <= precision;
6467
}
6568

6669
/// <inheritdoc />

0 commit comments

Comments
 (0)