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

How can I shoot bullets that you can aim with the crosshair?

$
0
0
I just implemented a shooting mechanism into my gun where bullets are created and move out of the barrel of the gun forwards and since they come from the barrel, their direction doesn't match the crosshair in the middle of the screen. How can I make the bullets move so you can aim with the crosshair? here is my script: /* private void ShootGun() { GameObject bullet = Instantiate(bulletModel, gunPos.position, gunPos.rotation); bullet.AddComponent(typeof(Rigidbody)); Rigidbody rb = bullet.GetComponent(); rb.useGravity = false; rb.velocity = camera.forward * speed; } */

Viewing all articles
Browse latest Browse all 592

Trending Articles



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