In my project, I have a ship that moves and increases it's movement speed with respect to time and how long the acceleration button is being pushed(just like the way a real life car works), now as expected, the ship fires projectiles when I press the fire button.
The problem here, is that at a point in the game, the ship reaches it's highest speed/terminal velocity, and now it's faster than the projectile it fired which is not what I want, so, how do I create a realistic projectile movement based on the ship's velocity? This is so that if the projectile is fired when the ship is moving slowly through the game scene, it doesn't move so fast that we can't see it travelling in the forward direction, and at the same time if it is fired when the ship is moving at top speeds, the ship is not seen to be faster than or as fast as the projectile's speed.
I want to keep the code as optimized as possible, so I am using this line for the projectile's movement:
public float velocity = 100f;
void Update() {
transform.position += transform.forward * Time.deltaTime * velocity;
}