forked from mirror/DotRecast
refactor: FIND_LOCAL_NEIGHBOURHOOD
This commit is contained in:
parent
8ca7142bc5
commit
013a53fbc9
|
@ -695,19 +695,9 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
_tool.FindPolysAroundShape(navQuery, settings.agentHeight, m_startRef, m_endRef, m_spos, m_epos, m_filter, ref m_polys, ref m_parent, ref m_queryPoly);
|
||||
}
|
||||
else if (_mode == RcTestNavmeshToolMode.FIND_LOCAL_NEIGHBOURHOOD)
|
||||
{
|
||||
if (m_sposSet && m_startRef != 0)
|
||||
{
|
||||
m_neighbourhoodRadius = settings.agentRadius * 20.0f;
|
||||
List<long> resultRef = new();
|
||||
List<long> resultParent = new();
|
||||
var status = navQuery.FindLocalNeighbourhood(m_startRef, m_spos, m_neighbourhoodRadius, m_filter, ref resultRef, ref resultParent);
|
||||
if (status.Succeeded())
|
||||
{
|
||||
m_polys = resultRef;
|
||||
m_parent = resultParent;
|
||||
}
|
||||
}
|
||||
_tool.FindLocalNeighbourhood(navQuery, m_startRef, m_spos, m_neighbourhoodRadius, m_filter, ref m_polys, ref m_parent);
|
||||
}
|
||||
else if (_mode == RcTestNavmeshToolMode.RANDOM_POINTS_IN_CIRCLE)
|
||||
{
|
||||
|
|
|
@ -338,6 +338,27 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
return status;
|
||||
}
|
||||
|
||||
public DtStatus FindLocalNeighbourhood(DtNavMeshQuery navQuery, long startRef, RcVec3f spos, float radius, IDtQueryFilter filter,
|
||||
ref List<long> resultRef, ref List<long> resultParent)
|
||||
{
|
||||
if (startRef == 0)
|
||||
{
|
||||
resultRef?.Clear();
|
||||
resultParent?.Clear();
|
||||
return DtStatus.DT_FAILURE;
|
||||
}
|
||||
|
||||
resultRef ??= new List<long>();
|
||||
resultParent ??= new List<long>();
|
||||
|
||||
resultRef.Clear();
|
||||
resultParent.Clear();
|
||||
|
||||
var status = navQuery.FindLocalNeighbourhood(startRef, spos, radius, filter, ref resultRef, ref resultParent);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public DtStatus FindPolysAroundShape(DtNavMeshQuery navQuery, float agentHeight, long startRef, long endRef, RcVec3f spos, RcVec3f epos, IDtQueryFilter filter,
|
||||
ref List<long> resultRefs, ref List<long> resultParents, ref RcVec3f[] queryPoly)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue