forked from bit/DotRecastNetSim
remove VSet
This commit is contained in:
parent
ba63c95806
commit
50090a4555
|
@ -121,12 +121,6 @@ namespace DotRecast.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void VSet(ref Vector3f @out, float a, float b, float c)
|
|
||||||
{
|
|
||||||
@out.x = a;
|
|
||||||
@out.y = b;
|
|
||||||
@out.z = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void VCopy(ref Vector3f @out, float[] @in)
|
public static void VCopy(ref Vector3f @out, float[] @in)
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,6 +103,14 @@ namespace DotRecast.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void Set(float a, float b, float c)
|
||||||
|
{
|
||||||
|
x = a;
|
||||||
|
y = b;
|
||||||
|
z = c;
|
||||||
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public readonly float Length()
|
public readonly float Length()
|
||||||
{
|
{
|
||||||
|
|
|
@ -165,7 +165,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
public Crowd(CrowdConfig config, NavMesh nav, Func<int, IQueryFilter> queryFilterFactory)
|
public Crowd(CrowdConfig config, NavMesh nav, Func<int, IQueryFilter> queryFilterFactory)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
VSet(ref _ext, config.maxAgentRadius * 2.0f, config.maxAgentRadius * 1.5f, config.maxAgentRadius * 2.0f);
|
_ext.Set(config.maxAgentRadius * 2.0f, config.maxAgentRadius * 1.5f, config.maxAgentRadius * 2.0f);
|
||||||
|
|
||||||
_obstacleQuery = new ObstacleAvoidanceQuery(config.maxObstacleAvoidanceCircles, config.maxObstacleAvoidanceSegments);
|
_obstacleQuery = new ObstacleAvoidanceQuery(config.maxObstacleAvoidanceCircles, config.maxObstacleAvoidanceSegments);
|
||||||
|
|
||||||
|
@ -1261,11 +1261,11 @@ namespace DotRecast.Detour.Crowd
|
||||||
// Agents on top of each other, try to choose diverging separation directions.
|
// Agents on top of each other, try to choose diverging separation directions.
|
||||||
if (idx0 > idx1)
|
if (idx0 > idx1)
|
||||||
{
|
{
|
||||||
VSet(ref diff, -ag.dvel.z, 0, ag.dvel.x);
|
diff.Set(-ag.dvel.z, 0, ag.dvel.x);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VSet(ref diff, ag.dvel.z, 0, -ag.dvel.x);
|
diff.Set(ag.dvel.z, 0, -ag.dvel.x);
|
||||||
}
|
}
|
||||||
|
|
||||||
pen = 0.01f;
|
pen = 0.01f;
|
||||||
|
|
|
@ -341,9 +341,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
{
|
{
|
||||||
for (int x = 0; x < m_params.gridSize; ++x)
|
for (int x = 0; x < m_params.gridSize; ++x)
|
||||||
{
|
{
|
||||||
Vector3f vcand = new Vector3f();
|
Vector3f vcand = Vector3f.Of(cvx + x * cs - half, 0f, cvz + y * cs - half);
|
||||||
VSet(ref vcand, cvx + x * cs - half, 0f, cvz + y * cs - half);
|
|
||||||
|
|
||||||
if (Sqr(vcand.x) + Sqr(vcand.z) > Sqr(vmax + cs / 2))
|
if (Sqr(vcand.x) + Sqr(vcand.z) > Sqr(vmax + cs / 2))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -462,8 +460,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
|
|
||||||
// Start sampling.
|
// Start sampling.
|
||||||
float cr = vmax * (1.0f - m_params.velBias);
|
float cr = vmax * (1.0f - m_params.velBias);
|
||||||
Vector3f res = new Vector3f();
|
Vector3f res = Vector3f.Of(dvel.x * m_params.velBias, 0, dvel.z * m_params.velBias);
|
||||||
VSet(ref res, dvel.x * m_params.velBias, 0, dvel.z * m_params.velBias);
|
|
||||||
int ns = 0;
|
int ns = 0;
|
||||||
for (int k = 0; k < depth; ++k)
|
for (int k = 0; k < depth; ++k)
|
||||||
{
|
{
|
||||||
|
@ -473,8 +470,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
|
|
||||||
for (int i = 0; i < npat; ++i)
|
for (int i = 0; i < npat; ++i)
|
||||||
{
|
{
|
||||||
Vector3f vcand = new Vector3f();
|
Vector3f vcand = Vector3f.Of(res.x + pat[i * 2 + 0] * cr, 0f, res.z + pat[i * 2 + 1] * cr);
|
||||||
VSet(ref vcand, res.x + pat[i * 2 + 0] * cr, 0f, res.z + pat[i * 2 + 1] * cr);
|
|
||||||
if (Sqr(vcand.x) + Sqr(vcand.z) > Sqr(vmax + 0.001f))
|
if (Sqr(vcand.x) + Sqr(vcand.z) > Sqr(vmax + 0.001f))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,9 @@ namespace DotRecast.Detour.Extras.Jumplink
|
||||||
this.trajectory = trajectory;
|
this.trajectory = trajectory;
|
||||||
ax = edge.sq.Subtract(edge.sp);
|
ax = edge.sq.Subtract(edge.sp);
|
||||||
ax.Normalize();
|
ax.Normalize();
|
||||||
VSet(ref az, ax.z, 0, -ax.x);
|
az.Set(ax.z, 0, -ax.x);
|
||||||
az.Normalize();
|
az.Normalize();
|
||||||
VSet(ref ay, 0, 1, 0);
|
ay.Set(0, 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue