When I shoot the gun it only shoots one way no matter what direction I'm facing
My script on the gun
public GameObject bullet;
public float fireRate = 10f;
private float nextFire = 0.0f;
public float bulletSpeed = 100f;
void Update()
{
if (Input.GetButton("Fire1") && Time.time > nextFire)
{
nextFire = Time.time +firerate;
GameObject Bullet = Instantiate(bullet, transform.position, transform.rotation) as GameObject;
Bullet.rigidbody.AddForce(Vector3.forward * bulletSpeed);
}
}
}
My script on the bullet
Public GameObject spawnPoint;
void Update ()
{
Destroy (gameObject, 5);
}
Void FixedUpdate()
{
rigidbody..AddForce(Vector3.forward * 100);
}
}
↧