refactor PATHFIND_SLICED

This commit is contained in:
ikpil 2023-09-10 14:37:02 +09:00
parent 013a53fbc9
commit ab05f845ca
2 changed files with 8 additions and 8 deletions

View File

@ -669,13 +669,9 @@ public class TestNavmeshSampleTool : ISampleTool
}
else if (_mode == RcTestNavmeshToolMode.PATHFIND_SLICED)
{
m_polys = null;
m_straightPath = null;
if (m_sposSet && m_eposSet && m_startRef != 0 && m_endRef != 0)
{
m_pathFindStatus = _tool.InitSlicedFindPath(navQuery, m_startRef, m_endRef, m_spos, m_epos, m_filter, _enableRaycast);
}
m_polys?.Clear();
m_straightPath?.Clear();
m_pathFindStatus = _tool.InitSlicedFindPath(navQuery, m_startRef, m_endRef, m_spos, m_epos, m_filter, _enableRaycast);
}
else if (_mode == RcTestNavmeshToolMode.RAYCAST)
{
@ -708,7 +704,6 @@ public class TestNavmeshSampleTool : ISampleTool
public void HandleUpdate(float dt)
{
// TODO Auto-generated method stub
if (_mode == RcTestNavmeshToolMode.PATHFIND_SLICED)
{
DtNavMeshQuery navQuery = _sample.GetNavMeshQuery();

View File

@ -200,6 +200,11 @@ namespace DotRecast.Recast.Toolset.Tools
public DtStatus InitSlicedFindPath(DtNavMeshQuery navQuery, long startRef, long endRef, RcVec3f startPos, RcVec3f endPos, IDtQueryFilter filter, bool enableRaycast)
{
if (startRef == 0 || endRef == 0)
{
return DtStatus.DT_FAILURE;
}
return navQuery.InitSlicedFindPath(startRef, endRef, startPos, endPos, filter,
enableRaycast ? DtNavMeshQuery.DT_FINDPATH_ANY_ANGLE : 0,
float.MaxValue