I have a simpel topdown view with 1 model. This model has a rigidbody on it with, and can shoot bullets with this script:
if (Input.GetKey(keyFire) && Time.time > nextFire)
{
nextFire = Time.time + fireRate;
var projectile = Instantiate(bullet, transform.position + Vector3(0,0,0), transform.rotation);
projectile.rigidbody.AddForce(transform.forward * bulletSpeed * (rigidbody.velocity.magnitude + 1));
}
Now I am taking the speed from rigidbody and multiply this with the bulletspeed, but it is not very linear, when the model is not moving the bullet just falls out with very slow speed.
How can I make sure the bullet always travels at the same speed, no matter what the speed of the model is?