SOH allocation issues

https://github.com/ikpil/DotRecast/issues/41
This commit is contained in:
ikpil 2024-05-03 22:00:51 +09:00
parent bef346a8cb
commit a5a101c0c2
1 changed files with 2 additions and 2 deletions

View File

@ -41,9 +41,9 @@ namespace DotRecast.Detour
public DtNavMeshQuery(DtNavMesh nav) public DtNavMeshQuery(DtNavMesh nav)
{ {
m_nav = nav; m_nav = nav;
m_tinyNodePool = new DtNodePool();
m_nodePool = new DtNodePool(); m_nodePool = new DtNodePool();
m_openList = new DtNodeQueue(); m_openList = new DtNodeQueue();
m_tinyNodePool = new DtNodePool();
} }
/// Returns random location on navmesh. /// Returns random location on navmesh.
@ -386,7 +386,7 @@ namespace DotRecast.Detour
float s = frand.Next(); float s = frand.Next();
float t = frand.Next(); float t = frand.Next();
float[] areas = new float[randomPolyVerts.Length / 3]; Span<float> areas = stackalloc float[randomPolyVerts.Length / 3];
RcVec3f pt = DtUtils.RandomPointInConvexPoly(randomPolyVerts, randomPolyVerts.Length / 3, areas, s, t); RcVec3f pt = DtUtils.RandomPointInConvexPoly(randomPolyVerts, randomPolyVerts.Length / 3, areas, s, t);
ClosestPointOnPoly(randomPolyRef, pt, out var closest, out var _); ClosestPointOnPoly(randomPolyRef, pt, out var closest, out var _);