When I spawn a bullet in-game, it sometimes moves to the left or right before going forward. Also, if I spawn one bullet going in one direction and another in a different direction, it seems to yank the other bullet in the direction it’s going for a short distance. Here is a link to a video of this happening:
https://drive.google.com/open?id=0B_HzgsC9lP3nS2RkUC1xRkU1Tmc
Here is my bullet spawning script:
using UnityEngine;
using System.Collections;
public class BulletController : MonoBehaviour {
public GameObject BulletSpawn;
public GameObject Bullet;
GameObject BulletClone;
public float BulletSpeed;
void Update()
{
if (Input.GetKeyDown("space") == true)
{
BulletClone = (GameObject)Instantiate(Bullet, BulletSpawn.transform.position, BulletSpawn.transform.rotation);
}
Rigidbody rBody = GetComponent<Rigidbody>();
rBody.velocity = BulletClone.transform.forward * BulletSpeed;
}
}
Why are my bullets acting weird?