Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class BallFall : MonoBehaviour
  5. {
  6.     public GameObject projectile;
  7.  
  8.     void Update()
  9.     {
  10.  
  11.         if (Input.GetButton("Fire1"))
  12.         {
  13.            
  14.             Instantiate(projectile, transform.position, transform.rotation);
  15.            
  16.             projectile.rigidbody.velocity = transform.TransformDirection(Vector3.forward * 10);
  17.         }
  18.  
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement