my bullets are shooting floating upwards and I don’t know why
they float hi to the ceiling instead of shooting forward
please help
2 scripts on them below
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BulletFireScript : MonoBehaviour {
public float fireTime = .05f;
public GameObject bullet;
public int pooledAmount = 20;
List< GameObject> bullets;
void Start () {
Debug.logger.logEnabled = false;
bullets = new List <GameObject> ();
for (int i = 0; i < pooledAmount; i++) {
GameObject obj = (GameObject)Instantiate (bullet);
obj.SetActive (false);
bullets.Add (obj);
}
InvokeRepeating ("Fire", fireTime, fireTime);
}
void Fire()
{
for (int i = 0; i < bullets.Count; i++)
{
if (!bullets *.activeInHierarchy)*
-
{*
_ bullets .transform.position = transform.position;_
_ bullets .transform.rotation = transform.rotation;
bullets .SetActive (true);
* break;
}
}
}
}*_
--------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BulletScript : MonoBehaviour {
* public float speed = 5;*
* // Update is called once per frame*
* void Update ()*
* {*
_ transform.Translate (0, speed * Time.deltaTime, 0);
* }
}*_