Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var bullet : Transform; //Your bullet prefab. Should have a RigidBody
- var speed : float = 10.0f;
- var muzzlePoint : Transform; //Your SpawnPoint
- function Update() {
- if(Input.GetButtonDown("Jump")) {
- var instance:Transform = Instantiate(bullet, Vector3((muzzlePoint.position.x+0.1),muzzlePoint.position.y,muzzlePoint.position.z), muzzlePoint.rotation);
- Destory(instance, 5);
- instance.velocity = muzzlePoint.forward * speed;
- }
- }
Add Comment
Please, Sign In to add comment