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

Fps Gun Scrpt :)

$
0
0
I'm making a FPS i attached a game object to the main camera of a first person controller the game object is to serve as a spawn point to the gun but when i move the camera up and down in the game the spawn point doesnt move i attatched it using parenting here's my script please help thanks #pragma strict var bullitPrefab:Transform; var perShotDelay = 0.15; private var timestamp = 0.0; private var spawn : Transform; function Start() { spawn = GameObject.Find("spawn").transform; } function Update() { if(Input.GetMouseButton(0) && Time.time > timestamp) { timestamp = Time.time + perShotDelay; var bullit = Instantiate(bullitPrefab, spawn.position,Quaternion.identity); bullit.rigidbody.AddForce(transform.forward * 50000); } }

Viewing all articles
Browse latest Browse all 592

Trending Articles



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