Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class GunShooting : MonoBehaviour {
- public Rigidbody Bullet;
- public Transform ShotPosition;
- public float shotForce = 1000f;
- // Update is called once per frame
- void Update ()
- {
- if (Input.GetButtonDown ("Fire1"))
- {
- Rigidbody shot = Instantiate (Bullet, ShotPosition.position, ShotPosition.rotation) as Rigidbody;
- shot.AddForce (ShotPosition.forward * shotForce);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement