mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
fix(Core/RPG): Stop next to quest objects instead of on top of them
This commit is contained in:
parent
85e2a940a1
commit
edc999c8ac
@ -463,7 +463,9 @@ bool NewRpgBaseAction::MoveWorldObjectTo(ObjectGuid guid, float distance)
|
||||
angle = object->GetOrientation() +
|
||||
(M_PI * irand(-25, 25) / 100.0); // 45 degrees infront of target (leading it's movement)
|
||||
|
||||
float rnd = rand_norm();
|
||||
// Bias toward the full radius so the bot stops next to the object,
|
||||
// not on top of it. Uniform rnd would put dest anywhere in [0, distance].
|
||||
float rnd = 0.85f + 0.15f * rand_norm();
|
||||
x += cos(angle) * distance * rnd;
|
||||
y += sin(angle) * distance * rnd;
|
||||
if (!object->GetMap()->CheckCollisionAndGetValidCoords(object, object->GetPositionX(), object->GetPositionY(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user