bounce pad
This commit is contained in:
@@ -436,10 +436,14 @@ public Vector3 GetVelocity()
|
||||
/// <param name="bounciness">How bouncy the surface is</param>
|
||||
/// </summary>
|
||||
public void Bounce(float bounciness)
|
||||
{
|
||||
if (verticalVelocity < -3f)
|
||||
{
|
||||
float bounceForce = -verticalVelocity * bounciness;
|
||||
verticalVelocity = bounceForce;
|
||||
moveDir.y = bounceForce;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
@@ -473,7 +477,6 @@ private void OnControllerColliderHit(ControllerColliderHit hit)
|
||||
if (bouncePad != null)
|
||||
{
|
||||
Bounce(bouncePad.bounciness);
|
||||
Debug.Log("Bounce! " + verticalVelocity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user