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

My gun won't fire. ( Javascript )

$
0
0
I built my own gun with blender. I've only been using Unity and Blender for a few days. I watched this video. http://www.youtube.com/watch?v=NPlRbxJtKxE and used a script from this guys comment GyratinVibratinD1LD01 month ago Heres the script that works . var projectile : Rigidbody; var speed = 10; function Update () { if (Input.GetButtonUp ("Fire1")) { clone = Instantiate(projectile, transform.position, transform.rotation); clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed)); Destroy (clone.gameObject, 5); }} I dragged a sphere into rigidbody for the spawn, which is placed at the muzzle of my gun. The sphere has a physics property of rigidbody. Here's my script. var projectile : Rigidbody ; var speed = 10; function update () { if(Input.GetButtonUp ("Fire1")) { clone = Instantiate(projectile, transform.position, transform.rotation); clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed)); Destroy (clone.gameObject, .25); }}

Viewing all articles
Browse latest Browse all 592

Trending Articles



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