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

How do i make my gun do damage?

$
0
0
Can someone help me make a new code or edit a code to make my gun do damage? Thanks using UnityEngine; using System.Collections; public class Shooting : MonoBehaviour { public Rigidbody projectile; public float speed = 20; // Use this for initialization void Start() { } // Update is called once per frame void Update() { if (Input.GetButtonDown("Fire1")) { Rigidbody instantiatedProjectile = Instantiate(projectile, transform.position, transform.rotation) as Rigidbody; instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(0, 0, speed)); } } }

Viewing all articles
Browse latest Browse all 592

Trending Articles