diff --git a/src/DotRecast.Core/Numerics/RcVec3f.cs b/src/DotRecast.Core/Numerics/RcVec3f.cs index 2066a9d..8da28a6 100644 --- a/src/DotRecast.Core/Numerics/RcVec3f.cs +++ b/src/DotRecast.Core/Numerics/RcVec3f.cs @@ -109,13 +109,9 @@ namespace DotRecast.Core.Numerics [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly RcVec3f Add(RcVec3f v2) + public static RcVec3f Add(RcVec3f left, RcVec3f right) { - return new RcVec3f( - X + v2.X, - Y + v2.Y, - Z + v2.Z - ); + return left + right; } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -270,7 +266,11 @@ namespace DotRecast.Core.Numerics [MethodImpl(MethodImplOptions.AggressiveInlining)] public static RcVec3f operator +(RcVec3f left, RcVec3f right) { - return left.Add(right); + return new RcVec3f( + left.X + right.X, + left.Y + right.Y, + left.Z + right.Z + ); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/DotRecast.Detour.Crowd/DtCrowd.cs b/src/DotRecast.Detour.Crowd/DtCrowd.cs index a0912a6..fe59f36 100644 --- a/src/DotRecast.Detour.Crowd/DtCrowd.cs +++ b/src/DotRecast.Detour.Crowd/DtCrowd.cs @@ -1273,7 +1273,7 @@ namespace DotRecast.Detour.Crowd continue; } - ag.npos = ag.npos.Add(ag.disp); + ag.npos = RcVec3f.Add(ag.npos, ag.disp); } } } diff --git a/src/DotRecast.Detour.Crowd/DtCrowdAgent.cs b/src/DotRecast.Detour.Crowd/DtCrowdAgent.cs index b46b02a..1e37f78 100644 --- a/src/DotRecast.Detour.Crowd/DtCrowdAgent.cs +++ b/src/DotRecast.Detour.Crowd/DtCrowdAgent.cs @@ -117,7 +117,7 @@ namespace DotRecast.Detour.Crowd float ds = dv.Length(); if (ds > maxDelta) dv = dv.Scale(maxDelta / ds); - vel = vel.Add(dv); + vel = RcVec3f.Add(vel, dv); // Integrate if (vel.Length() > 0.0001f) diff --git a/src/DotRecast.Detour/DtNavMesh.cs b/src/DotRecast.Detour/DtNavMesh.cs index 4a1b7a0..b3b0606 100644 --- a/src/DotRecast.Detour/DtNavMesh.cs +++ b/src/DotRecast.Detour/DtNavMesh.cs @@ -1353,7 +1353,7 @@ namespace DotRecast.Detour bool overPoly = false; RcVec3f bmin = RcVec3f.Subtract(center, halfExtents); - RcVec3f bmax = center.Add(halfExtents); + RcVec3f bmax = RcVec3f.Add(center, halfExtents); // Get nearby polygons from proximity grid. List polys = QueryPolygonsInTile(tile, bmin, bmax); diff --git a/src/DotRecast.Detour/DtNavMeshQuery.cs b/src/DotRecast.Detour/DtNavMeshQuery.cs index 8b86a07..21c460f 100644 --- a/src/DotRecast.Detour/DtNavMeshQuery.cs +++ b/src/DotRecast.Detour/DtNavMeshQuery.cs @@ -680,7 +680,7 @@ namespace DotRecast.Detour // Find tiles the query touches. RcVec3f bmin = RcVec3f.Subtract(center, halfExtents); - RcVec3f bmax = center.Add(halfExtents); + RcVec3f bmax = RcVec3f.Add(center, halfExtents); foreach (var t in QueryTiles(center, halfExtents)) { QueryPolygonsInTile(t, bmin, bmax, filter, query); @@ -700,7 +700,7 @@ namespace DotRecast.Detour } RcVec3f bmin = RcVec3f.Subtract(center, halfExtents); - RcVec3f bmax = center.Add(halfExtents); + RcVec3f bmax = RcVec3f.Add(center, halfExtents); m_nav.CalcTileLoc(bmin, out var minx, out var miny); m_nav.CalcTileLoc(bmax, out var maxx, out var maxy);