rigidbody get velocity code example
Example 1: rigidbody velocity c# unity
//for rigidbody2D
GetComponent<Rigidbody2D>().velocity =new Vector2(40,0);
Example 2: rigidbody velocity
rb.velocity = new Vector3(0, 10, 0);
//for rigidbody2D
GetComponent<Rigidbody2D>().velocity =new Vector2(40,0);
rb.velocity = new Vector3(0, 10, 0);