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

How to i make ray casting go to the part's right side?

Asked by 4 years ago

So, Im trying to make the ray casting that go towards an part, To go to the right side instead of just foward, I tried using vector3.new like this

local Part = plr.Character.HumanoidRootPart
local rayDetector = Ray.new(Part.CFrame,Part.CFrame.LookVector * Vector3.new(3,0,-5)) 
local DetectedPart = workspace:FindPartOnRay(rayDetector , plr.Character)

if DetectedPart then
      print("Output is " .. DetectedPart.Name )
end

But when i tested it Instead of going from side to the caracter, It dont detects on where the character root part is looking, It detects on another direction I dont know how to fix it

Answer this question