# How do I give my ejected bullet shell a speed plus the player's current speed?

If my player is running around in the game and I eject a shell from his gun when I fire, how do I make sure the speed the shell travels is in addition to the speed the player is already moving?

Basically, I want it to always look like the shell is flying out and off to the right of the gun regardless of what direction the player is running around in or how fast they are moving, as it looks wrong just now with the shell looking like it’s flying more to the left if I move right and more to the right if I move left, so I want to set the shell’s speed on top of whatever speed the player is already moving in whatever direction.

You know, like if I throw something while stationary vs in a vehicle moving at 60mph, the object will travel at its normal speed plus my current speed so it will actually be moving faster if I throw it from the moving car.

Get the Rigidbody component of the gun. Instantiate the casing, let’s say it’s ‘c’. Get 'c’s Rigidbody, then copy the gun’s velocity with something like:

`````` c_rb.velocity = gun_rb.velocity;
``````

Where c_rb is the casing’s Rigidbody, and gun_rb is the gun’s Rigidbody. Then apply the ejection force.