var bulletPrefab:Transform;
function Update ()
{
if(Input.GetButtonDown("Fire1"))
{
//Create bullet
var bullet = Instantiate(bulletPrefab, GameObject.Find("spawnPoint").transform.position, Quaternion.identity);
//Direction of bullet and add force
bullet.rigidbody.AddForce(transform.forward * 5000);
}
}
But it does not shoot properly. When I turn right it does not shoot, it just creates the bullet in front of the gun. Also when I shoot at certain angles it does not shoot to where I am aiming it shoots to the left. Besides this it works fine. What am I doing wrong?