My player is always bouncing but it bounces higher and higher. I want to limit the speed so my player won’t be so fast. I’m using rigidbody.AddForce for the bounce.
Solved with this codes:
//Limit Speed
float maxSpeed = 10f;
if (rb.velocity.magnitude > maxSpeed)
{
rb.velocity = Vector3.ClampMagnitude(rb.velocity, maxSpeed);
}
//if you want to check.
void OnGUI()
{
GUI.Label(new Rect(20, 20, 200, 200), "rigidbody velocity: " + rb.velocity);
}
Uhm… if it keeps bouncing higher and higher and you already use AddForce to add the bounce force to the player per script, I think there’s a material on that block with bounciness over 0 on it. Maybe you should reduce that to 0.