custom script rigidbody move in unity code example
Example 1: unity how to set rigidbody velocity
Vector3 velocity = new Vector3(10f/*x*/, 10f/*y*/, 10f/*z*/);
GetComponent<Rigidbody>().velocity = velocity;
Example 2: unity move with rigidbody.moveposition
rb2D.MovePosition(rb2D.position + velocity * Time.fixedDeltaTime);