Random point in circle #153381
Random point in circle
#153381
-
BodyHaiii, i'm not that good at math but how do i generate a random point in a circle in the coding language: lua Ta - Seyyaa Guidelines
|
Beta Was this translation helpful? Give feedback.
Answered by
mbvanderleest
Mar 7, 2025
Replies: 1 comment
-
|
Simpel! function GetRandomPointInCircle(center, radius)
local angle = math.random() * 2 * math.pi
local distance = math.sqrt(math.random()) * radius
local x = center.x + (math.cos(angle) * distance)
local y = center.y + (math.sin(angle) * distance)
local groundZ = 10
return vector3(x, y, groundZ)
end |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Arootsy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simpel!