# (2D) Take player speed into account while shooting bullets

In my top down 2D game, there is a plane as shown below:

The plane shoots bullets forward. For firing bullets, I use:

obj.GetComponent<Rigidbody2D>().AddForce(transform.up*500);


However, when player presses up arrow or A key, plane speed increases. At this point, bullets are slower than the plane and appear to move backwards when plane moves at maximum speed.

How do I take into account player speed so that force applied takes into account player speed?

There are lacking of code, however I would suggest that the bullet obj is a result of the method Instantiate. If it so, you should just inherit velocity of the plane right after instantiation and before adding force.
GameObject obj = Instantiate(bulletPrefab, plane.tranform.position, plane.transform.rotation) as GameObject;