//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;
}
}
Vector3 velocity = new Vector3(10f/*x*/, 10f/*y*/, 10f/*z*/);
GetComponent<Rigidbody>().velocity = velocity;
//Drecrese Rigidbody Speed
[SerializeField] private Rigidbody rb;
void FixedUpdate() {
//Decrease speed
rb.velocity -= rb.velocity * 0.1f;
}
rb.velocity = new Vector3(0, 10, 0);