Is there any ways to make the system overall functions better ?
This is the code:
local indicator = Instance.new("Part", workspace)
indicator.Shape = "Ball"
indicator.Anchored = true
indicator.Material = Enum.Material.Neon
indicator.BrickColor = BrickColor.new("Bright red")
indicator.CanCollide = false
game:GetService("RunService").RenderStepped:Connect(function()
local ray = Ray.new(hrp.Position, camera.CFrame.LookVector * 300)
local part, pos = workspace:FindPartOnRayWithIgnoreList(ray, rayIgnore)
if part then
if part:IsA("Part") and not part:IsA("MeshPart") then
pos = Vector3.new(pos.X, part.Position.Y + part.Size.Y/2, pos.Z )
indicator.Position = pos
end
end
end)
this is cause your not doing it as local let me explain so if a part is rotated its Y would appear at top aka global to make it local use CFrame.UpVector That may help
I want it to find the nearest edge, the problem with my system currently, is that it only work when you are looking at the side of a part, due to to this pos = Vector3.new(pos.X, part.Position.Y + part.Size.Y/2, pos.Z ) But when I am on top of the part, however, it wont detect any edges, as seen here: https://gyazo.com/3a1fe1e4293ba99a21f8762a42f9251f
I mainly desire for it to work with normal parts and wedges