Quantcast
Channel: Questions in topic: "gun"
Viewing all articles
Browse latest Browse all 592

Raycast shooting

$
0
0
I have a weapon firing using raycast, when i click the mouse it fires, but the muzzle flash only appears when im pointing it at a target. any suggestions as to why this happens? the shoot section of the code void Shoot() { RaycastHit hit; if (Physics.Raycast (fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { Debug.Log (hit.transform.name); Instantiate (flash, flashSpawn.position, flashSpawn.rotation); //addition Target target = hit.transform.GetComponent(); if (target != null) { target.TakeDamage(damage); } } } }

Viewing all articles
Browse latest Browse all 592

Latest Images

Trending Articles



Latest Images

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