mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +00:00
fix(Core/Movement) Smoother movement of hunter pets when following players (#16796)
* Pets follow the player at the player's speed * More accurate distance measurement
This commit is contained in:
@@ -303,29 +303,15 @@ static Optional<float> GetVelocity(Unit* owner, Unit* target, G3D::Vector3 const
|
||||
}
|
||||
|
||||
UnitMoveType moveType = Movement::SelectSpeedType(moveFlags);
|
||||
speed = std::max(target->GetSpeed(moveType), owner->GetSpeed(moveType));
|
||||
|
||||
speed = target->GetSpeed(moveType);
|
||||
if (playerPet)
|
||||
{
|
||||
float distance = owner->GetDistance2d(dest.x, dest.y) - (*speed / 2.f);
|
||||
float distance = owner->GetDistance2d(dest.x, dest.y) - target->GetObjectSize() - (*speed / 2.f);
|
||||
if (distance > 0.f)
|
||||
{
|
||||
float multiplier = 1.f + (distance / 10.f);
|
||||
*speed *= multiplier;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (moveType)
|
||||
{
|
||||
case MOVE_RUN_BACK:
|
||||
case MOVE_SWIM_BACK:
|
||||
case MOVE_FLIGHT_BACK:
|
||||
break;
|
||||
default:
|
||||
*speed *= 0.9f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user