# Create a simple machine gun

**URL:** <https://forum.babylonjs.com/t/create-a-simple-machine-gun/14771>\
**Category:** Questions\
**Created:** [October 8, 2020, 1:09pm UTC](https://forum.babylonjs.com/t/create-a-simple-machine-gun/14771 "2020-10-08T13:09:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![REX\_DUNGEUR](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rex_dungeur/32/17559_2.png) [@REX\_DUNGEUR](https://forum.babylonjs.com/u/REX_DUNGEUR)\
**Post date:** [October 8, 2020, 1:09pm UTC](https://forum.babylonjs.com/t/create-a-simple-machine-gun/14771/1 "2020-10-08T13:09:27Z")

</div>

Hi guys!  
In the moment I’m trying to make a gun witch can fire bullets (could be spheres) if you press the left mouse button. But I don’t know how I can do it…

Can somebody help me?  
Yours,  
_ **Rex Dungeur** _

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [October 9, 2020, 2:14pm UTC](https://forum.babylonjs.com/t/create-a-simple-machine-gun/14771/2 "2020-10-09T14:14:49Z")

</div>

Do it step by step. First try to create a playground that displays a console message when the use presses the left mouse button.  
Then, I would create a pool (an array) of maybe 10 spheres. And when firing, I’d add an animation to one of those spheres.

---

<div class="post-metadata">

**Author:** ![REX\_DUNGEUR](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rex_dungeur/32/17559_2.png) [@REX\_DUNGEUR](https://forum.babylonjs.com/u/REX_DUNGEUR)\
**Post date:** [October 9, 2020, 2:20pm UTC](https://forum.babylonjs.com/t/create-a-simple-machine-gun/14771/3 "2020-10-09T14:20:25Z")

</div>

First that:  
[https://playground.babylonjs.com/#UK6WTT#8](https://playground.babylonjs.com/#UK6WTT#8)

 ![Screenshot from 2020-10-09 16-19-26](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/0/03dc8aa0ab039804cc3f3813332c8c090fdef864.jpeg)

And then?

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [October 9, 2020, 2:23pm UTC](https://forum.babylonjs.com/t/create-a-simple-machine-gun/14771/4 "2020-10-09T14:23:05Z")

</div>

check this page [Interact with a Scene - Babylon.js Documentation](https://doc.babylonjs.com/how_to/interactions)

---

<div class="post-metadata">

**Author:** ![REX\_DUNGEUR](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rex_dungeur/32/17559_2.png) [@REX\_DUNGEUR](https://forum.babylonjs.com/u/REX_DUNGEUR)\
**Post date:** [October 9, 2020, 2:57pm UTC](https://forum.babylonjs.com/t/create-a-simple-machine-gun/14771/6 "2020-10-09T14:57:27Z")

</div>

That’s a cannon witch shoots from alone…  
But nice project 🙂

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [October 9, 2020, 3:41pm UTC](https://forum.babylonjs.com/t/create-a-simple-machine-gun/14771/7 "2020-10-09T15:41:59Z")

</div>

Many demos will not 100% fit your needs, you will need to connect the pieces and make it your own. You have a shooting cannon, you have a way to interact with the scene - put them together and you’ve got yourself a gun 🙂

---

<div class="post-metadata">

**Author:** ![REX\_DUNGEUR](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rex_dungeur/32/17559_2.png) [@REX\_DUNGEUR](https://forum.babylonjs.com/u/REX_DUNGEUR)\
**Post date:** [October 10, 2020, 3:19pm UTC](https://forum.babylonjs.com/t/create-a-simple-machine-gun/14771/9 "2020-10-10T15:19:44Z")

</div>

Lol 🙂

---

<div class="post-metadata">

**Author:** ![AB\_08122010](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@AB\_08122010](https://forum.babylonjs.com/u/AB_08122010)\
**Post date:** [October 29, 2021, 5:17pm UTC](https://forum.babylonjs.com/t/create-a-simple-machine-gun/14771/10 "2021-10-29T17:17:08Z")

</div>

very nice
