Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple Method - Slope Under Player
private float groundSlopeAngle = 0f; // angle
private Vector3 groundSlopeDir;
// The controller hits a collider while performing a Move.
void OnControllerColliderHit (ControllerColliderHit hit)
{
Vector3 temp = Vector3.Cross(hit.normal, Vector3.down);
groundSlopeDir = Vector3.Cross(temp, hit.normal);
groundSlopeAngle = Vector3.Angle(hit.normal, Vector3.up);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment