So I am making a ledge climb system for our first person adventure game. The ledge climb almost works completely as intended but I have a problem where the player can hang on the edges of a ledge.
For whatever reason I cant upload files because I am a new user so I am gonna try to explain it as best as possible.
So whenever the player falls I have 3 line traces coming down in front of the player. Whenever one of the line traces hits a surface, I shoot another line trace from the player position to the place the line trace hit the surface. Then I place the player on the impact normal of the second raycast.
what this means is that if the second raycast hits the side of the ledge, the player will hang on the side of the ledge. But I need the player to only hang on the front side of the ledge.
Hm sorry this is not super helpful.
I’d be more interested to see what your traces look like, because “coming down in front” is a bit vague.
From the drawings, it kind of looks like you want your character to climb if the trace hits a horizontal surface, but not if it hits a vertical surface ? Are you doing trace like this ? Is this correct ?
If that is the case, you can check the HitNormal of the trace hit, and compare it against the world’s up vector (X=0,Y=0,Z=1) using Dot product. If dot product equals 1 then your surface is fully horizontal. If the dot product is greater than 0.7 then your surface is within 45° of horizontal-ness and should be “walkable” (as per default project settings anyways).