From b0644a70b71eb58e53d00a04a0708491b2c8c6ba Mon Sep 17 00:00:00 2001 From: ikpil Date: Thu, 25 Jan 2024 00:43:40 +0900 Subject: [PATCH] fix : SOH issue (#41) - https://github.com/ikpil/DotRecast/issues/41#issuecomment-1908359895 --- src/DotRecast.Detour/DtNavMesh.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/DotRecast.Detour/DtNavMesh.cs b/src/DotRecast.Detour/DtNavMesh.cs index a10cf07..094bd5d 100644 --- a/src/DotRecast.Detour/DtNavMesh.cs +++ b/src/DotRecast.Detour/DtNavMesh.cs @@ -21,6 +21,7 @@ freely, subject to the following restrictions: using System; using System.Collections.Generic; using DotRecast.Core; +using DotRecast.Core.Buffers; using DotRecast.Core.Numerics; namespace DotRecast.Detour @@ -1246,14 +1247,14 @@ namespace DotRecast.Detour int ip = poly.index; - float[] verts = new float[m_maxVertPerPoly * 3]; + using var verts = RcRentedArray.RentDisposableArray(m_maxVertPerPoly * 3); int nv = poly.vertCount; for (int i = 0; i < nv; ++i) { - RcArrays.Copy(tile.data.verts, poly.verts[i] * 3, verts, i * 3, 3); + RcArrays.Copy(tile.data.verts, poly.verts[i] * 3, verts.AsRentedArray(), i * 3, 3); } - if (!DtUtils.PointInPolygon(pos, verts, nv)) + if (!DtUtils.PointInPolygon(pos, verts.AsRentedArray(), nv)) { return false; }