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