Guest User

Untitled

a guest
Jan 22nd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. var bullet : Transform; //Your bullet prefab. Should have a RigidBody
  2. var speed : float = 10.0f;
  3. var muzzlePoint : Transform; //Your SpawnPoint
  4.  
  5. function Update() {
  6. if(Input.GetButtonDown("Jump")) {
  7. var instance = Instantiate(bullet, Vector3((muzzlePoint.position.x+0.1),muzzlePoint.position.y,muzzlePoint.position.z), muzzlePoint.rotation);
  8.  
  9. Destory(instance, 5);
  10. instance.velocity = muzzlePoint.forward * speed;
  11. }
  12.  
  13. }
Add Comment
Please, Sign In to add comment