Answers for "how to decrease velocity of a Unity rigidbody"

C#
1

how to set rigidbody velocity in unity

//Set Velocity to a certain speed
[SerializeField] private float maxSpeed = 10;
[SerializeField] private Rigidbody rb;

void FixedUpdate() {
  if(rb.velocity.magnitude > maxSpeed) {
    rb.velocity = rb.velocity.normalized * maxSpeed;
  }
}
Posted by: Guest on September-15-2021
4

unity how to set rigidbody velocity

Vector3 velocity = new Vector3(10f/*x*/, 10f/*y*/, 10f/*z*/);
GetComponent<Rigidbody>().velocity = velocity;
Posted by: Guest on December-19-2019
0

rigidbody velocity

rb.velocity = new Vector3(0, 10, 0);
Posted by: Guest on February-09-2020
0

how to decrease velocity of a Unity rigidbody

//Drecrese Rigidbody Speed
[SerializeField] private Rigidbody rb;

void FixedUpdate() {
  //Decrease speed
  rb.velocity -= rb.velocity * 0.1f;
}
Posted by: Guest on September-15-2021

Code answers related to "how to decrease velocity of a Unity rigidbody"

C# Answers by Framework

Browse Popular Code Answers by Language