So i made a climbing system with all different movement directions, the problem is that the system lets you move up, down, left and right while climbing, but the climbing can only be activated when the player is looking at a wall.
How could i make a way for it to be activated while the character is on the top of a wall? Example:
Okay so shoot a ray under your rootpart, and a ray from in front of your rootpart
if the one from the front detects nothing, and the one from under does you can calculate the yposition of both your root, and the part the ray detected. If your root is higher than the y position of the other part, then you can climb. I’m not really sure how to make your player start climbing on the specific surface you’re near though.
You could use “raycasting” to detect when a player approaches a cliff. Then either teleport the player down beside the closest wall, or :Play() an animation that smoothly lowers the player down into a climbing position. You would have to do some math to figure out exactly where to bring the player from the ledge, but it’s definitely do-able. I’m sure there are tons of possible ways to accomplish this, but this is what I would try first.
The raycasting is pretty self explanatory.
It can be done as @Dracolyx explained.
In order to make the player climb on the surface they are closest to, I would do something like this:
Step 1. Figure out the positions of each of the edges of the part you are standing on. You could do this with some code similar to this:
local EdgeAPos = Part.Position + Vector3. new(Part.Size.X/2,Part.Size.Y/2,0)
local EdgeBPos = Part.Position + Vector3. new(-Part.Size.X/2,Part.Size.Y/2,0)
local EdgeCPos = Part.Position + Vector3. new(0,Part.Size.Y/2,Part.Size.Z/2)
local EdgeDPos = Part.Position + Vector3. new(0,Part.Size.Y/2,-Part.Size.Z/2)
Step 2. Once you have done this, you can figure out which one of these Edges the player is closest to using .Magnitude.
local magnitudeA = (character. HumanoidRootPart.Position - EdgeAPos).Magnitude
--ect.
Step 3. Then once you have done this, you can simply move the player character to the closest edge position (probably with a few tweaks so that the player is not sticking in the wall).
The code above is just an example that .I have made on mobile, so it might have a few typos. It’s just an example .
Hope this helps you out!