I am trying to make a Circle that appears below the Characters feet, acting as a perimeter surrounding the Player. Anyone to step anywhere past the Circumference of the Circle will have their current location tracked. I would like to return their distance from the Center of the Circle, Circumference and CFrame
. I'm not entirely sure whether it's best to use the HumanoidRootPart
as the Centerpoint, but if so then that's fine. I'm not sure how to do this, could anyone help me? I also have one other Circumference calculation that acts as a halfway point, the idea of this function is to hurt the Player at a higher rate the close they are.
game.Players.PlayerAdded:Connect(function(pl) local ch = pl.Character math.randomseed(tick()) if (ch) then local camera = workspace.CurrentCamera local fov = math.clamp(math.ceil(camera.FieldOfView/2)), 25, 45) local pi = 3.14 local di = math.random(25, fov) local ra = (d/2) local ci = 2(pi)ra local cir = Instance.new("Part"); cir.Parent = ch end end
This is the basic idea of what I have, also, for a Weld
, how would I have it stay on the Ground, and not angle if you jump as R15?
I can't answer your question entirely but i assure you that using this following distance calculation could help you alot:
(part1.Position - part2.Position).magnitude -- Distance between two points