Hi,
Recently started using unity and I’m having a problem adding relative force to a bullet. The position the bullet spawns at is just in front on the player controller, however I can’t make it shoot forward it just spawns and lands on the floor. Any help would be appreciated.
#pragma strict
var bullet : Rigidbody;
var bulletSpeed : int = 100;
function Start () {
}
function Update () {
if (Input.GetMouseButtonDown(0))
{
Debug.Log ("Left click detected");
Instantiate (bullet, this.transform.position, Quaternion.identity);
bullet.AddRelativeForce(Vector3.forward * bulletSpeed);
}
}