I'm making a climbing script that allows the player to climb certain walls in the game. I am trying to make the player orientation so it's facing the building. Example
Now here’s the reason why my question is awfully long, you can’t just have the player face towards the center of the building, this is incorrect, instead you need them to be aligned with the wall. The easiest way this can be done is through raycasting.
So using FindPartOnRayWithIgnoreList it is possible to get the surface direction easily.
local ignoreList = {}
local characterDes = Char:GetDescendants()
for i, instance in pairs(characterDes) do
if instance.ClassName == "Part" then -- is it a part the ray could hit
table.insert(ignoreList, instance) -- Add the part to the ignoreList
end
end
local surfaceray = Ray.new(character.HumanoidRootPart.Position, character.HumanoidRootPart.Position+[CLIMBABLE_PART_HERE].Position)
local part, position, surface = workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
Okay now that you've caught up with me, how would I use this surface variable to CFrame my character through the use of BodyGyro? I can't really think of any efficient way to use this veriable. Could someone help me understand the maths behind orienting the player using this?

1 comment
Can u explain how u did ?