Redirect Raycasts Along Normals?

Currently, my dash script uses a simple raycast to project infront of the player a certain amount of distance and then moves the player to that position. Although this works great if all land is flat and even with no obstacales, it gets tricky for slopes/curved walls/and other differently oriented parts.

Heres a representation of what mines looks like:

I was thinking of “redirect” ing the raycast along the normal of a slope/wall/part in order for it to keep going til it reaches the remaining distance or hits something again, similar to “reflective raycasts”. Issue is though, since the ending position relies on where the raycast ends, I’ll have to offset the raycast, I could offset the ending pos of the raycast but that gets a little more tricky for the first raycast.

Heres what I’m thinking of:
(For Slopes)

(For Walls)

I know that raycasts return a “normal” with them however, they usually only lead to:

(0-1, 0-1, 0-1)

The developer hub doesn’t really explain how you would work with these values (I usually learn off examples which is why this makes it difficult for me), I know that the higher the value y is, the more steeper the slope is (if I’m right?) and the higher the z value is, the more slanted/flat the slope is. I’m assuming the x value is for slanted walls though I haven’t tested it yet.

My first solution to the offset will just be pushing the location from where it hit a few studs back which should be simple enough (hopefully), second part with normals however- I don’t really know :man_shrugging:

Anyway I could apply the value of normals from raycasts to a direction for the raycast to go in?

local ray1 = Ray.new(Part.Position, Part.CFrame.LookVector * 10)
local _, pos, normal = workspace:FindPartOnRay(ray1)
local ray2 = Ray.new(pos + (Part.CFrame:VectorToWorldSpace(Vector3.new(0,0,1) * 0.25), normal)