Implemented basic wallrunning

This commit is contained in:
Gregory Campbell
2019-12-21 23:17:24 -05:00
parent a31a335424
commit f1db804155
3 changed files with 18 additions and 2 deletions
+15
View File
@@ -45,6 +45,16 @@ public class PlayerController : MonoBehaviour
maxSpeedStore = maxSpeed;
}
void OnControllerColliderHit(ControllerColliderHit hit)
{
if(hit.gameObject.tag == "Wall")
{
gravity = 0.5f;
}
}
void Update()
{
@@ -133,6 +143,11 @@ public class PlayerController : MonoBehaviour
jump++;
}
if (characterController.collisionFlags == CollisionFlags.None)
{
gravity = 5;
}
moveDirection.y += Physics.gravity.y * gravity * Time.deltaTime;
velocity = Vector3.ClampMagnitude(velocity, maxSpeed);