Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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;
  }
}
Comment

unity how to set rigidbody velocity

Vector3 velocity = new Vector3(10f/*x*/, 10f/*y*/, 10f/*z*/);
GetComponent<Rigidbody>().velocity = velocity;
Comment

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;
}
Comment

rigidbody velocity

rb.velocity = new Vector3(0, 10, 0);
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# object list to joined string 
Csharp :: async await c# 
Csharp :: sealed method in c# 
Csharp :: hide numericUpDown arrows 
Csharp :: math with c sharp 
Csharp :: jagged array to 2d array c# 
Csharp :: c# while loop 
Csharp :: c# static 
Csharp :: for statement syntax C sharp 
Csharp :: how to cut a string in c# 
Csharp :: loading player preferences unity 
Csharp :: unity auto scroll 
Csharp :: C# Blocks with statements 
Csharp :: getelement video 
Csharp :: monogame print 
Csharp :: xamarin set environment variables 
Csharp :: unity DOScale 
Csharp :: int model property shows 0 in textbox .net core 
Csharp :: connect to a database and loop over a recordset in C# 
Csharp :: c# how to delete all files in directory 
Csharp :: referans tipi nedir c# 
Csharp :: Unlit shader get the direction of camera UNity 
Csharp :: c# while true loop 
Csharp :: c# unit test exception using try catch 
Csharp :: c# listview add items horizontally 
Csharp :: c# in equivalent 
Csharp :: string.insert c# 
Csharp :: unity how to check index of enum 
Csharp :: strinng.indexOf c# 
Csharp :: change physics material unity 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =