Skip to content

Commit

Permalink
fix: SOH issue(#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikpil committed Jan 24, 2024
1 parent 401c955 commit ddb7f72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DotRecast.Detour/DtNavMeshQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2185,7 +2185,7 @@ public DtStatus Raycast(long startRef, RcVec3f startPos, RcVec3f endPos, IDtQuer

hit = new DtRaycastHit();

RcVec3f[] verts = new RcVec3f[m_nav.GetMaxVertsPerPoly() + 1];
using var verts = RcRentedArray.RentDisposableArray<RcVec3f>(m_nav.GetMaxVertsPerPoly() + 1);

RcVec3f curPos = RcVec3f.Zero;
RcVec3f lastPos = RcVec3f.Zero;
Expand Down Expand Up @@ -2218,7 +2218,7 @@ public DtStatus Raycast(long startRef, RcVec3f startPos, RcVec3f endPos, IDtQuer
nv++;
}

bool intersects = DtUtils.IntersectSegmentPoly2D(startPos, endPos, verts, nv, out var tmin, out var tmax, out var segMin, out var segMax);
bool intersects = DtUtils.IntersectSegmentPoly2D(startPos, endPos, verts.AsRentedArray(), nv, out var tmin, out var tmax, out var segMin, out var segMax);
if (!intersects)
{
// Could not hit the polygon, keep the old t and report hit.
Expand Down

0 comments on commit ddb7f72

Please sign in to comment.