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
e42b284d84
commit
20a8ec1ef0
@ -462,7 +462,9 @@ bool NewRpgBaseAction::MoveWorldObjectTo(ObjectGuid guid, float distance)
|
|||||||
angle = object->GetOrientation() +
|
angle = object->GetOrientation() +
|
||||||
(M_PI * irand(-25, 25) / 100.0); // 45 degrees infront of target (leading it's movement)
|
(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;
|
x += cos(angle) * distance * rnd;
|
||||||
y += sin(angle) * distance * rnd;
|
y += sin(angle) * distance * rnd;
|
||||||
if (!object->GetMap()->CheckCollisionAndGetValidCoords(object, object->GetPositionX(), object->GetPositionY(),
|
if (!object->GetMap()->CheckCollisionAndGetValidCoords(object, object->GetPositionX(), object->GetPositionY(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user