forked from bit/DotRecastNetSim
change public api in StraightPathItem
This commit is contained in:
parent
f9c79c9b71
commit
04fd0abea0
|
@ -944,7 +944,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
// and short cut to there.
|
// and short cut to there.
|
||||||
if ((ag.option.updateFlags & DtCrowdAgentParams.DT_CROWD_OPTIMIZE_VIS) != 0 && ag.corners.Count > 0)
|
if ((ag.option.updateFlags & DtCrowdAgentParams.DT_CROWD_OPTIMIZE_VIS) != 0 && ag.corners.Count > 0)
|
||||||
{
|
{
|
||||||
RcVec3f target = ag.corners[Math.Min(1, ag.corners.Count - 1)].GetPos();
|
RcVec3f target = ag.corners[Math.Min(1, ag.corners.Count - 1)].pos;
|
||||||
ag.corridor.OptimizePathVisibility(target, ag.option.pathOptimizationRange, _navQuery,
|
ag.corridor.OptimizePathVisibility(target, ag.option.pathOptimizationRange, _navQuery,
|
||||||
_filters[ag.option.queryFilterType]);
|
_filters[ag.option.queryFilterType]);
|
||||||
|
|
||||||
|
@ -993,7 +993,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
|
|
||||||
// Adjust the path over the off-mesh connection.
|
// Adjust the path over the off-mesh connection.
|
||||||
long[] refs = new long[2];
|
long[] refs = new long[2];
|
||||||
if (ag.corridor.MoveOverOffmeshConnection(ag.corners[ag.corners.Count - 1].GetRef(), refs, ref anim.startPos,
|
if (ag.corridor.MoveOverOffmeshConnection(ag.corners[ag.corners.Count - 1].refs, refs, ref anim.startPos,
|
||||||
ref anim.endPos, _navQuery))
|
ref anim.endPos, _navQuery))
|
||||||
{
|
{
|
||||||
anim.initPos = ag.npos;
|
anim.initPos = ag.npos;
|
||||||
|
|
|
@ -131,13 +131,13 @@ namespace DotRecast.Detour.Crowd
|
||||||
if (0 == corners.Count)
|
if (0 == corners.Count)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool offMeshConnection = ((corners[corners.Count - 1].GetFlags()
|
bool offMeshConnection = ((corners[corners.Count - 1].flags
|
||||||
& DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
|
& DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
|
||||||
? true
|
? true
|
||||||
: false;
|
: false;
|
||||||
if (offMeshConnection)
|
if (offMeshConnection)
|
||||||
{
|
{
|
||||||
float distSq = RcVec3f.Dist2DSqr(npos, corners[corners.Count - 1].GetPos());
|
float distSq = RcVec3f.Dist2DSqr(npos, corners[corners.Count - 1].pos);
|
||||||
if (distSq < radius * radius)
|
if (distSq < radius * radius)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -150,9 +150,9 @@ namespace DotRecast.Detour.Crowd
|
||||||
if (0 == corners.Count)
|
if (0 == corners.Count)
|
||||||
return range;
|
return range;
|
||||||
|
|
||||||
bool endOfPath = ((corners[corners.Count - 1].GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_END) != 0) ? true : false;
|
bool endOfPath = ((corners[corners.Count - 1].flags & DtNavMeshQuery.DT_STRAIGHTPATH_END) != 0) ? true : false;
|
||||||
if (endOfPath)
|
if (endOfPath)
|
||||||
return Math.Min(RcVec3f.Dist2D(npos, corners[corners.Count - 1].GetPos()), range);
|
return Math.Min(RcVec3f.Dist2D(npos, corners[corners.Count - 1].pos), range);
|
||||||
|
|
||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
|
@ -164,8 +164,8 @@ namespace DotRecast.Detour.Crowd
|
||||||
{
|
{
|
||||||
int ip0 = 0;
|
int ip0 = 0;
|
||||||
int ip1 = Math.Min(1, corners.Count - 1);
|
int ip1 = Math.Min(1, corners.Count - 1);
|
||||||
var p0 = corners[ip0].GetPos();
|
var p0 = corners[ip0].pos;
|
||||||
var p1 = corners[ip1].GetPos();
|
var p1 = corners[ip1].pos;
|
||||||
|
|
||||||
var dir0 = p0.Subtract(npos);
|
var dir0 = p0.Subtract(npos);
|
||||||
var dir1 = p1.Subtract(npos);
|
var dir1 = p1.Subtract(npos);
|
||||||
|
@ -191,7 +191,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
RcVec3f dir = new RcVec3f();
|
RcVec3f dir = new RcVec3f();
|
||||||
if (0 < corners.Count)
|
if (0 < corners.Count)
|
||||||
{
|
{
|
||||||
dir = corners[0].GetPos().Subtract(npos);
|
dir = corners[0].pos.Subtract(npos);
|
||||||
dir.y = 0;
|
dir.y = 0;
|
||||||
dir.Normalize();
|
dir.Normalize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,8 +123,8 @@ namespace DotRecast.Detour.Crowd
|
||||||
int start = 0;
|
int start = 0;
|
||||||
foreach (StraightPathItem spi in corners)
|
foreach (StraightPathItem spi in corners)
|
||||||
{
|
{
|
||||||
if ((spi.GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0
|
if ((spi.flags & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0
|
||||||
|| RcVec3f.Dist2DSqr(spi.GetPos(), m_pos) > MIN_TARGET_DIST)
|
|| RcVec3f.Dist2DSqr(spi.pos, m_pos) > MIN_TARGET_DIST)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
for (int i = start; i < corners.Count; i++)
|
for (int i = start; i < corners.Count; i++)
|
||||||
{
|
{
|
||||||
StraightPathItem spi = corners[i];
|
StraightPathItem spi = corners[i];
|
||||||
if ((spi.GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
|
if ((spi.flags & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
|
||||||
{
|
{
|
||||||
end = i + 1;
|
end = i + 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -35,20 +35,5 @@ namespace DotRecast.Detour
|
||||||
this.flags = flags;
|
this.flags = flags;
|
||||||
this.refs = refs;
|
this.refs = refs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RcVec3f GetPos()
|
|
||||||
{
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetFlags()
|
|
||||||
{
|
|
||||||
return flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long GetRef()
|
|
||||||
{
|
|
||||||
return refs;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -426,16 +426,16 @@ public class CrowdTool : IRcTool
|
||||||
dd.Begin(LINES, 2.0f);
|
dd.Begin(LINES, 2.0f);
|
||||||
for (int j = 0; j < ag.corners.Count; ++j)
|
for (int j = 0; j < ag.corners.Count; ++j)
|
||||||
{
|
{
|
||||||
RcVec3f va = j == 0 ? pos : ag.corners[j - 1].GetPos();
|
RcVec3f va = j == 0 ? pos : ag.corners[j - 1].pos;
|
||||||
RcVec3f vb = ag.corners[j].GetPos();
|
RcVec3f vb = ag.corners[j].pos;
|
||||||
dd.Vertex(va.x, va.y + radius, va.z, DuRGBA(128, 0, 0, 192));
|
dd.Vertex(va.x, va.y + radius, va.z, DuRGBA(128, 0, 0, 192));
|
||||||
dd.Vertex(vb.x, vb.y + radius, vb.z, DuRGBA(128, 0, 0, 192));
|
dd.Vertex(vb.x, vb.y + radius, vb.z, DuRGBA(128, 0, 0, 192));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ag.corners[ag.corners.Count - 1].GetFlags()
|
if ((ag.corners[ag.corners.Count - 1].flags
|
||||||
& DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
|
& DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
|
||||||
{
|
{
|
||||||
RcVec3f v = ag.corners[ag.corners.Count - 1].GetPos();
|
RcVec3f v = ag.corners[ag.corners.Count - 1].pos;
|
||||||
dd.Vertex(v.x, v.y, v.z, DuRGBA(192, 0, 0, 192));
|
dd.Vertex(v.x, v.y, v.z, DuRGBA(192, 0, 0, 192));
|
||||||
dd.Vertex(v.x, v.y + radius * 2, v.z, DuRGBA(192, 0, 0, 192));
|
dd.Vertex(v.x, v.y + radius * 2, v.z, DuRGBA(192, 0, 0, 192));
|
||||||
}
|
}
|
||||||
|
|
|
@ -456,7 +456,7 @@ public class TestNavmeshTool : IRcTool
|
||||||
StraightPathItem straightPathItem = m_straightPath[i];
|
StraightPathItem straightPathItem = m_straightPath[i];
|
||||||
StraightPathItem straightPathItem2 = m_straightPath[i + 1];
|
StraightPathItem straightPathItem2 = m_straightPath[i + 1];
|
||||||
int col;
|
int col;
|
||||||
if ((straightPathItem.GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
|
if ((straightPathItem.flags & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
|
||||||
{
|
{
|
||||||
col = offMeshCol;
|
col = offMeshCol;
|
||||||
}
|
}
|
||||||
|
@ -465,10 +465,10 @@ public class TestNavmeshTool : IRcTool
|
||||||
col = spathCol;
|
col = spathCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
dd.Vertex(straightPathItem.GetPos().x, straightPathItem.GetPos().y + 0.4f,
|
dd.Vertex(straightPathItem.pos.x, straightPathItem.pos.y + 0.4f,
|
||||||
straightPathItem.GetPos().z, col);
|
straightPathItem.pos.z, col);
|
||||||
dd.Vertex(straightPathItem2.GetPos().x, straightPathItem2.GetPos().y + 0.4f,
|
dd.Vertex(straightPathItem2.pos.x, straightPathItem2.pos.y + 0.4f,
|
||||||
straightPathItem2.GetPos().z, col);
|
straightPathItem2.pos.z, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
dd.End();
|
dd.End();
|
||||||
|
@ -477,15 +477,15 @@ public class TestNavmeshTool : IRcTool
|
||||||
{
|
{
|
||||||
StraightPathItem straightPathItem = m_straightPath[i];
|
StraightPathItem straightPathItem = m_straightPath[i];
|
||||||
int col;
|
int col;
|
||||||
if ((straightPathItem.GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_START) != 0)
|
if ((straightPathItem.flags & DtNavMeshQuery.DT_STRAIGHTPATH_START) != 0)
|
||||||
{
|
{
|
||||||
col = startCol;
|
col = startCol;
|
||||||
}
|
}
|
||||||
else if ((straightPathItem.GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_END) != 0)
|
else if ((straightPathItem.flags & DtNavMeshQuery.DT_STRAIGHTPATH_END) != 0)
|
||||||
{
|
{
|
||||||
col = endCol;
|
col = endCol;
|
||||||
}
|
}
|
||||||
else if ((straightPathItem.GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
|
else if ((straightPathItem.flags & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
|
||||||
{
|
{
|
||||||
col = offMeshCol;
|
col = offMeshCol;
|
||||||
}
|
}
|
||||||
|
@ -494,8 +494,8 @@ public class TestNavmeshTool : IRcTool
|
||||||
col = spathCol;
|
col = spathCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
dd.Vertex(straightPathItem.GetPos().x, straightPathItem.GetPos().y + 0.4f,
|
dd.Vertex(straightPathItem.pos.x, straightPathItem.pos.y + 0.4f,
|
||||||
straightPathItem.GetPos().z, col);
|
straightPathItem.pos.z, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
dd.End();
|
dd.End();
|
||||||
|
@ -523,10 +523,10 @@ public class TestNavmeshTool : IRcTool
|
||||||
{
|
{
|
||||||
StraightPathItem straightPathItem = m_straightPath[i];
|
StraightPathItem straightPathItem = m_straightPath[i];
|
||||||
StraightPathItem straightPathItem2 = m_straightPath[i + 1];
|
StraightPathItem straightPathItem2 = m_straightPath[i + 1];
|
||||||
dd.Vertex(straightPathItem.GetPos().x, straightPathItem.GetPos().y + 0.4f,
|
dd.Vertex(straightPathItem.pos.x, straightPathItem.pos.y + 0.4f,
|
||||||
straightPathItem.GetPos().z, spathCol);
|
straightPathItem.pos.z, spathCol);
|
||||||
dd.Vertex(straightPathItem2.GetPos().x, straightPathItem2.GetPos().y + 0.4f,
|
dd.Vertex(straightPathItem2.pos.x, straightPathItem2.pos.y + 0.4f,
|
||||||
straightPathItem2.GetPos().z, spathCol);
|
straightPathItem2.pos.z, spathCol);
|
||||||
}
|
}
|
||||||
|
|
||||||
dd.End();
|
dd.End();
|
||||||
|
@ -534,8 +534,8 @@ public class TestNavmeshTool : IRcTool
|
||||||
for (int i = 0; i < m_straightPath.Count; ++i)
|
for (int i = 0; i < m_straightPath.Count; ++i)
|
||||||
{
|
{
|
||||||
StraightPathItem straightPathItem = m_straightPath[i];
|
StraightPathItem straightPathItem = m_straightPath[i];
|
||||||
dd.Vertex(straightPathItem.GetPos().x, straightPathItem.GetPos().y + 0.4f,
|
dd.Vertex(straightPathItem.pos.x, straightPathItem.pos.y + 0.4f,
|
||||||
straightPathItem.GetPos().z, spathCol);
|
straightPathItem.pos.z, spathCol);
|
||||||
}
|
}
|
||||||
|
|
||||||
dd.End();
|
dd.End();
|
||||||
|
|
Loading…
Reference in New Issue