Core/Movement: only set velocity values for follow movement if we have to rely on our follow target's speed

This commit is contained in:
Ovahlord committed 2020-04-06 01:25:23 +02:00
1 parent 0d84daa39c
commit 479437f8d6
1 file changed
+3 -4
@@ -116,12 +116,10 @@ bool FollowMovementGenerator::Update(Unit* owner, uint32 diff)
velocity = target->GetSpeed(MOVE_RUN);
}
}
else
velocity = owner->IsWalking() ? owner->GetSpeed(MOVE_WALK) : owner->GetSpeed(MOVE_RUN);
// Follow target based speed allignment
float distance = owner->GetExactDist2d(dest);
if (_useTargetSpeed)
if (_useTargetSpeed && velocity > 0.f)
{
// Determine catchup speed rate
@@ -144,7 +142,8 @@ bool FollowMovementGenerator::Update(Unit* owner, uint32 diff)
Movement::MoveSplineInit init(owner);
init.MoveTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ());
init.SetVelocity(velocity);
if (velocity > 0.f)
init.SetVelocity(velocity);
init.Launch();
_hasStopped = false;