I’m having issues with Raycasting at the moment - I’m just messing around with it at the moment, however as you can see from the visual rods, it has moments of inaccuracy, this results in the location changing willy nilly etc.
I’ve attached the code below.
game:GetService("RunService").RenderStepped:Connect(function()
local RCResult0
local Origin, Direction
if PseudoPart.Parent == Character then
Origin, Direction = PseudoPart.Position, PseudoPart.Position - Vector3.new(0, 1000, 0)
RCResult0 = workspace:Raycast(Origin, Direction, RaycastParam)
else
Origin, Direction = Camera.CFrame.p, Camera.CFrame.p - Vector3.new(0, 1000, 0)
RCResult0 = workspace:Raycast(Origin, Direction - Vector3.new(0, 1000, 0), RaycastParam)
end
visualizeRay(Origin, Direction)
if RCResult0 then
if CurrentLoc == RCResult0.Instance.Parent then else
CurrentLoc = RCResult0.Instance.Parent
Render.Lighting(); ScreenGui:ClearAllChildren(); Render.Text()
end
else
if CurrentLoc == Whitelist["Space"]["HitPart"].Parent then else
CurrentLoc = Whitelist["Space"]["HitPart"].Parent
Render.Lighting(); ScreenGui:ClearAllChildren()
end
end
end)