diff --git a/src/DotRecast.Detour.Crowd/DtCrowd.cs b/src/DotRecast.Detour.Crowd/DtCrowd.cs index acf85e7..722c1df 100644 --- a/src/DotRecast.Detour.Crowd/DtCrowd.cs +++ b/src/DotRecast.Detour.Crowd/DtCrowd.cs @@ -581,7 +581,7 @@ namespace DotRecast.Detour.Crowd { throw new ArgumentException("Empty path"); } - + // Quick search towards the goal. _navQuery.InitSlicedFindPath(path[0], ag.targetRef, ag.npos, ag.targetPos, @@ -1178,10 +1178,8 @@ namespace DotRecast.Detour.Crowd } else { - var nsnvel = _obstacleQuery.SampleVelocityGrid(ag.npos, ag.option.radius, - ag.desiredSpeed, ag.vel, ag.dvel, option, vod); - ns = nsnvel.Item1; - ag.nvel = nsnvel.Item2; + ns = _obstacleQuery.SampleVelocityGrid(ag.npos, ag.option.radius, + ag.desiredSpeed, ag.vel, ag.dvel, out ag.nvel, option, vod); } _velocitySampleCount += ns; diff --git a/src/DotRecast.Detour.Crowd/DtObstacleAvoidanceQuery.cs b/src/DotRecast.Detour.Crowd/DtObstacleAvoidanceQuery.cs index 68d981b..c6c1620 100644 --- a/src/DotRecast.Detour.Crowd/DtObstacleAvoidanceQuery.cs +++ b/src/DotRecast.Detour.Crowd/DtObstacleAvoidanceQuery.cs @@ -319,7 +319,7 @@ namespace DotRecast.Detour.Crowd return penalty; } - public Tuple SampleVelocityGrid(RcVec3f pos, float rad, float vmax, RcVec3f vel, RcVec3f dvel, + public int SampleVelocityGrid(RcVec3f pos, float rad, float vmax, RcVec3f vel, RcVec3f dvel, out RcVec3f nvel, DtObstacleAvoidanceParams option, DtObstacleAvoidanceDebugData debug) { Prepare(pos, dvel); @@ -328,7 +328,7 @@ namespace DotRecast.Detour.Crowd m_vmax = vmax; m_invVmax = vmax > 0 ? 1.0f / vmax : float.MaxValue; - RcVec3f nvel = RcVec3f.Zero; + nvel = RcVec3f.Zero; if (debug != null) debug.Reset(); @@ -359,7 +359,7 @@ namespace DotRecast.Detour.Crowd } } - return Tuple.Create(ns, nvel); + return ns; } // vector normalization that ignores the y-component.