Implemented basic wallrunning
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user