using a rigid body to move a player unity code example
Example 1: how to add reference to rigidbody 2d
public Rigidbody2D rb;
Example 2: unity how to set rigidbody velocity
Vector3 velocity = new Vector3(10f/*x*/, 10f/*y*/, 10f/*z*/);
GetComponent<Rigidbody>().velocity = velocity;