fix an index error
This commit is contained in:
parent
24230e8e8d
commit
6624e7aef5
@ -1409,12 +1409,14 @@ void dtCrowd::update(const float dt, dtCrowdAgentDebugInfo* debug)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update agents using off-mesh connection.
|
// Update agents using off-mesh connection.
|
||||||
for (int i = 0; i < m_maxAgents; ++i)
|
for (int i = 0; i < nagents; ++i)
|
||||||
{
|
{
|
||||||
dtCrowdAgentAnimation* anim = &m_agentAnims[i];
|
dtCrowdAgent* ag = agents[i];
|
||||||
|
const int idx = (int)(ag - m_agents);
|
||||||
|
dtCrowdAgentAnimation* anim = &m_agentAnims[idx];
|
||||||
if (!anim->active)
|
if (!anim->active)
|
||||||
continue;
|
continue;
|
||||||
dtCrowdAgent* ag = agents[i];
|
|
||||||
|
|
||||||
anim->t += dt;
|
anim->t += dt;
|
||||||
if (anim->t > anim->tmax)
|
if (anim->t > anim->tmax)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user