mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
move random angle
This commit is contained in:
@@ -1473,8 +1473,9 @@ bool MoveRandomAction::Execute(Event event)
|
|||||||
float x = bot->GetPositionX();
|
float x = bot->GetPositionX();
|
||||||
float y = bot->GetPositionY();
|
float y = bot->GetPositionY();
|
||||||
float z = bot->GetPositionZ();
|
float z = bot->GetPositionZ();
|
||||||
x += urand(0, distance) - distance / 2;
|
float angle = (float)rand_norm() * static_cast<float>(M_PI);
|
||||||
y += urand(0, distance) - distance / 2;
|
x += urand(0, distance) * cos(angle);
|
||||||
|
y += urand(0, distance) * sin(angle);
|
||||||
bot->UpdateGroundPositionZ(x, y, z);
|
bot->UpdateGroundPositionZ(x, y, z);
|
||||||
|
|
||||||
if (map->IsInWater(bot->GetPhaseMask(), x, y, z, bot->GetCollisionHeight()))
|
if (map->IsInWater(bot->GetPhaseMask(), x, y, z, bot->GetCollisionHeight()))
|
||||||
|
|||||||
Reference in New Issue
Block a user