Created
August 3, 2015 06:06
-
-
Save jawinn/120abdb46f898e1318d1 to your computer and use it in GitHub Desktop.
Simple Method - Slope Under Player
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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