Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to determine a Vector3 Position inside of a Circular Field?

Asked by
Ziffixture 6913 Moderation Voter Community Moderator
5 years ago

I’ve been messing around lately, and decided to try and figure out how to determine the Vector3 location of an object, inside of a circle. The Circumference is based of the the FOV/2, you could say this is somewhat like a detection field, I’ve tried a lot of methods, but they just don’t work, could someone help me write an algorithm?

Thank you!

0
I'm confused. Are you asking how to determine if the object is in the circle radius, or are you asking how to get the vector3? greenhamster1 180 — 5y
0
Circle radius Ziffixture 6913 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Here's a solution:

local sphere = workspace.sphere
local part2 = workspace.part2

while true do
    wait()
    if (sphere.Position - part2.Position).magnitude < sphere.Size.X / 2 then
        --do whatever you want
    end
end

It might be a bit less efficient than other methods.

Hope this helps!

0
Where did you find this? I also wanted a circle not a sphere Ziffixture 6913 — 5y
Ad

Answer this question