Answers for "unity make rigidbody cap velocity"

C#
2

unityy limit rigidbody velocity

if(rigidbody.velocity.sqrMagnitude > maxVelocity)             
             {                 
               //smoothness of the slowdown is controlled by the 0.99f,                  
               //0.5f is less smooth, 0.9999f is more smooth                     
               rigidbody.velocity *= 0.99f;             
             }
Posted by: Guest on December-29-2020
0

how to clamp a velocity in unity c#

rigidbody2D.velocity = Vector2.ClampMagnitude(rigidbody2D.velocity, maxVelocity);
Posted by: Guest on January-09-2021

Code answers related to "unity make rigidbody cap velocity"

C# Answers by Framework

Browse Popular Code Answers by Language