Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Shoot : MonoBehaviour
- {
- public float speed;
- public Transform bullet;
- // Use this for initialization
- void Start ()
- {
- speed = 200;
- }
- // Update is called once per frame
- void Update ()
- {
- if(Input.GetKeyDown(KeyCode.Mouse0))
- {
- Transform projectile = Instantiate(bullet, transform.position, transform.rotation) as Transform;
- projectile.rigidbody.AddForce(transform.forward * speed);
- }
- }
- }
Add Comment
Please, Sign In to add comment