Character SlopeLimit

Since all my reading in the forum tells me that the slopeLimit doesn't work, is there a work around for this?

This is a "somewhat" solution here.

The real issue is that I have a character that is trying to walk up a hill and this solution works IF I head straight towards the hill. If I try and hit it at a different angle (like going up sideways) I am still able to walk up the hill (Forward vector facing different direction but the strafing is allowing the player up the hill).

A solution I have thought about would be to have a plane under the character and to check the verts of each of the corners to see what the normal under them are. Then do some quick trig to get the normals under.

This seems like a lot of overhead just to not go up a a hill.

Another thought if I can read the angle of the normal in relation to the global world, this may also work.

Hopefully someone will have a solution for this.

If you are using the CharacterController you can include void OnControllerColliderHit (ControllerColliderHit hit)

ControllerColliderHit contains the normal information for the surface you collided with - which you can compare to the worldUp vector for slope.

Extreme Sledding for the iPhone uses a character controller (not physics) and does all the slope / momentum / conservation of energy calculations in this way.

I don't know how I would implement it yet but I would think that the solution would be to determine the local gradient of the terrain; in other words, the steepest slope at the point the player is standing. Then take your player's desired movement direction and break it up (via dot products) into a component along the gradient and a component orthogonal to it (ie, along the contour of the hill) and treat those movements as separate things. So if the slopeLimit is such that motion along the steep slope is not permitted, that motion would be clamped to zero; but the motion along the contour would be unaffected. You could, hypothetically, limit or slow the motion "uphill" separately as well as opposed to making the transition a full stop.

I guess you could get the local gradient from a ray casting technique that the linked post describes, you'd just need to do one additional ray and displace it along an axis that is perpendicular to the first displacement.