Game/Entities: Fix math problem "Disk Point Picking" in GetRandomPoint (#17577)

This commit is contained in:
P-Kito authored and Aokromes committed 2016-07-20 19:20:09 +02:00
1 parent 615e3115ef
commit 33afe2d927
1 file changed
+2 -1
+2 -1
View File
@@ -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);