Get the velocity of the first person controller, then apply it to an instantiated projectile?

I'm using the FPS Tutorial as a base, so I have a FPS controller, with a "rocket launcher" attached to it, then the rocket launcher instantiates a rocket when fired. What I would like to do it have the FPS Controllers velocity transfer to the newly instantiated rocket, on top of the normal velocity so that a person who fires a rocket while moving will have a higher initial velocity than one that is standing still.

The best I could come up with was `instantiatedProjectile.velocity = transform.TransformDirection(Vector3 (0, 0, initialSpeed + movement.velocity.z));`. That sort of worked, but if I completely stopped, the velocity did not return to 0, but instead stayed at the "last moved" velocity. So, any ideas on how to make this work?

Thanks.

If you are using a rigidbody to control the movement of the FPS controller:

instantiatedProjectile.velocity = 
    rigidbody.velocity + initialSpeed * transform.forward;

If you are manually updating the FPS position then you will need to get the velocity variable to replace 'rigidbody.velocity'.

I’m tyring to do the same thing. The problem is that the FPScontroller is not using Ridigbody to move. So you cannot access its velocity through the rigidbody controller.