Hi everyone. Thanks for the help.
I'm using Unity 6.3 LTE. I have a CharacterController attached to a player, and am adding various desired Vector3's to the player based on desired movement.
I'm trying to overcome the problem where the player can approach an edge and begin 'walking off', and stick to the walls.
https://www.youtube.com/watch?v=Flral1NhFUo
Current Solution:
1.) Using Physics.SphereCast, I cast straight down for collision. With the _hit.point, I get the degree of the slope.
2.) If the degree isn't 0, I run a second Physics.RayCast straight down. If there's no ground within range, the player isn't on a slanted surface and must be hanging off a ledge, so I continue.
3.) If that degree when hanging off a ledge is greater to 10 degrees, I begin finding the angle to slowly push the player off the ledge. The percentage uses linear formula between 10 degrees (0%) to 80 degrees (100%), multiplying that against the maximum force (2 units up to 10 units), and the vector away from the ground (thus pushing them over the ledge).
https://codeshare.io/5OXoKj
As usual, everything works exactly as desired in the editor. As shown in the video, the bare minimum Velocity.Magnitude starts at 2 units per frame, increasing to 10 units per frame. For the editor part of the video, the moment the player reaches the ledge, I do not touch the keyboard anymore and the player slowly pushes off.
Immediately after, I build the game (to show no discrepancies) and perform the same exact action. As you see, the player doesn't exactly 'stick' to the wall, but doesn't have enough force applied to be pushed over the ledge.