Raycasting Help

Hey guys, so I am currently making a wall climbing script and I pretty much have all of it done. I just needed some help casting rays.

The issue here is that I have ray casting upwards, forward and downwards complete, but whenever I try to ray cast to the left or to the right I can’t seem to find out how.

Here are some examples of what I’ve tried so far to raycast to the right, but to no avail…

local Rightray = Ray.new(root.CFrame.p, (root.CFrame * CFrame.Angles(0, math.pi/2, 0)).lookVector*0.1)

That code is one I used to move my character to the right in one of my other scripts, so I tried to throw it in here but it obviously did not work. If any of you knows how to ray cast to the right or left, it’d be a great help for my development.

That’s all, hope you are all doing well.

you can use

local left = root.CFrame.RightVector * -1
local right = root.CFrame.RightVector
1 Like

Thank you it worked! Still new to raycasting haha