mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Game/Entities: Fix math problem "Disk Point Picking" in GetRandomPoint (#17577)
This commit is contained in:
@@ -1593,7 +1593,8 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran
|
||||
|
||||
// angle to face `obj` to `this`
|
||||
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
|
||||
float new_dist = (float)rand_norm()*static_cast<float>(distance);
|
||||
float new_dist = (float)rand_norm() + (float)rand_norm();
|
||||
new_dist = distance * (new_dist > 1 ? new_dist - 2 : new_dist);
|
||||
|
||||
rand_x = pos.m_positionX + new_dist * std::cos(angle);
|
||||
rand_y = pos.m_positionY + new_dist * std::sin(angle);
|
||||
|
||||
Reference in New Issue
Block a user