I don’t know why this doesn’t work. I can’t get the bullet to come out of the objects forward. It always goes forward in world space
using UnityEngine;
using System.Collections;
public class gun : MonoBehaviour {
public GameObject bullet;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void FixedUpdate () {
if (Input.GetKeyDown(KeyCode.Space))
{
Instantiate(bullet, transform.localPosition,Quaternion.Euler(Vector3.forward));
}
}
}