reset agent desired velocity in resetMoveTarget

Otherwise, if velocity was non zero at time resetMoveTarget is called the agent would continue to move indefinitely at that velocity (a straight line) which was not the intended behaviour.

As discussed in https://groups.google.com/forum/#!topic/recastnavigation/QoLNGz5o6e8
This commit is contained in:
Leif Gruenwoldt 2015-05-01 13:48:48 -04:00
parent acbbe507fd
commit 2ec9270b34

View File

@ -653,6 +653,7 @@ bool dtCrowd::resetMoveTarget(const int idx)
// Initialize request. // Initialize request.
ag->targetRef = 0; ag->targetRef = 0;
dtVset(ag->targetPos, 0,0,0); dtVset(ag->targetPos, 0,0,0);
dtVset(ag->dvel, 0,0,0);
ag->targetPathqRef = DT_PATHQ_INVALID; ag->targetPathqRef = DT_PATHQ_INVALID;
ag->targetReplan = false; ag->targetReplan = false;
ag->targetState = DT_CROWDAGENT_TARGET_NONE; ag->targetState = DT_CROWDAGENT_TARGET_NONE;