Bullet not always shooting in forward direction. Code included.

public Rigidbody bullet;
public float speed;
Rigidbody clone;

	void Update () {
		if (Input.GetKeyDown("space")){
			clone = Instantiate(bullet, transform.position, transform.rotation) as Rigidbody;
			clone.velocity = transform.forward * speed * Time.deltaTime;
			Destroy(clone.gameObject, 15);
		}
	}

My bullet is not always in the forward direction. Sometimes it doesn’t even shoot. Please help and thanks

@Prodigga has a good point in the comments plus if for instance you instantiate the bullet rigidbody directly ontop of whatever is shooting it and that thing has a collider then all hell will break loose :slight_smile:

You might want to try

 clone = Instantiate(bullet, transform.position + transform.forward * 1, transform.rotation) as Rigidbody

Where you should change the * 1 to be the size of the thing that is doing the shooting/2 + a fudge factor.

My first guess is that you should use Quaternion.identity instead of transform.rotation

so the line of code:

clone = Instantiate(bullet, transform.position, transform.rotation);

might need to be:

clone = Instantiate(bullet, transform.position, Quaternion.identity);

Another possibility is that you need to ignore collision for the bullet with the object it is shot from like this but with correct variables for your project:

Physics.IgnoreCollision(bullet.collider, player.collider);