Horje
rigidbody velocity Code Example
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;
  }
}
unity how to set rigidbody velocity
Vector3 velocity = new Vector3(10f/*x*/, 10f/*y*/, 10f/*z*/);
GetComponent<Rigidbody>().velocity = velocity;
rigidbody velocity c# unity
//for rigidbody2D
GetComponent<Rigidbody2D>().velocity =new Vector2(40,0);
rigidbody velocity
rb.velocity = new Vector3(0, 10, 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;
}
rigidbody.velocity.magnitude
//speed of rigidbody in m/s
float speed = rigidbody.velocity.magnitude;




Csharp

Related
how to write coroutine in unity Code Example how to write coroutine in unity Code Example
c# export datatatble to excel Code Example c# export datatatble to excel Code Example
C# Program For Check Total Occurrence Of A Number In An Array Code Example C# Program For Check Total Occurrence Of A Number In An Array Code Example
linq sum Code Example linq sum Code Example
dicionĂ¡rio c# foreach keyvaluepair Code Example dicionĂ¡rio c# foreach keyvaluepair Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10