Quantcast
Viewing latest article 1
Browse Latest Browse All 8

Bullets spawn behind the craft

Hi there! So, I've this problem, where I'm trying to fire a bullet from the same location as the player fighter craft. However, the bullet spawns from behind the fighter, and after setting the Colliders on both objects, they collide and eventually, the craft ends up being destroyed by its own bullets. Here's the function used to fire the bullets (a Coroutine that fires a burst of five bullets): IEnumerator gun_fire() { isFiring = true; GunSource.Play(); for (int x = 0; x < 5; x++) { Instantiate(bulletPrefab, transform.position, transform.rotation); bulletCount -= 1; yield return new WaitForSeconds(bulletCool); } isFiring = false; } So, is there any way of preventing this? (it seems that adding some Vector3 coordinates to transform.position doesn't work since they still spawn out of place... Thanks for any help. João Borrego

Viewing latest article 1
Browse Latest Browse All 8

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>