I’m using a character attached to a CharacterController in a 3rd person game, and I need to prevent them from falling off ledges by treating any sufficiently high ledge as a wall. Using invisible blocks for this isn’t going to work- I need to code something.
My first instinct was to do a raycast directly down, and have the player snap back to their previous position if it doesn’t hit anything. But that would be incredibly ugly- the player couldn’t slide along it as they would a wall, among other things.