how to make your own rigid body with code for movement in unity 2d code example
Example 1: how to add reference to rigidbody 2d
public Rigidbody2D rb;
Example 2: how to drag a 2d rigidbody in unity
// add this to your player. Make sure there is a rigidbody2d attached to it. private Vector2 direction; public float force = 1000; private Rigidbody2D r; void Start () { r = transform.GetComponent <Rigidbody2D> (); } void Update { if (Input.touchCount > 0) { target = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position); direction = (target.transform.position - transform.position).normalized; r.AddForce (direction * Time.deltaTime * force); } }