Simple Way to Make a Gun Shoot (In Blender BGE)

Hi. This tutorial will show a simple way to make a gun shoot in Blender.
I will be using Blender 2.63. You should make your gun first because I will not show you how to make a gun in Blender.

  1. Select your gun. Then add an Empty (Add>Empty) Place the Empty where you want the bullet to come out of.

  2. Make sure you have a bullet (Just add a Sphere to make the bullet, then put the bullet in layer two)

  3. Select the bullet, then go to the logic menu. In the logic menu: add a Sensor, make the Sensor “ALWAYS”. Add a controller, make it “AND”. Add an Actuator, make it “MOTION”, set the X axis Loc to 2.00. Connect them all together.

  4. Go to layer 2, RIGHT+CLICK on the Empty, SHIFT+RIGHT+CLICK on the gun. hit CTRL+P, then click on “SET PARENT TO OBJECT”

  5. Now select the Empty and add a Sensor, make it “KEYBOARD”. Now, click on the button next to “KEY” then hit any key that you will use the shoot. Then add a Controller, make it “AND”. Now add an actuator, make it “EDIT OBJECT”, then, right below “ADD OBJECT”, type in the name of the bullet.

Now you are done! CONGRATS! Press P to play.
***(If the bullet comes out of a different direction, rotate the empty until the bullet shoots in the direction you want)***

If you didn’t understand this, you can download the .blend file of this.



demo1.blend (462 KB)

You should make something to shoot at.I know how to make things explode.You want to know how to do it.

Nice tutorial, though I wouldn’t use this for actual gun firing. This is useful for turrets or things that shoot slower moving objects, though. Nice job.

this is just the basics

This is a good start, but is a heavily flawed method. First of all, if you have a physical bullet like that, you have problems with collision if the velocity is too high, hence why most games use rays. Second of all, if you do use a physical bullet, you should atleast use a lower poly count.

I think it is fine for slow moving, mid-size to large size objects. The bounding box could be sphere or box for less impact on Physics.

Use cases: Catapults, Granates, Missiles, Eggs etc.


  • The Bullet should get an initial velocity, whether from AddObjectActuator or directly after object creation (Always Sensor) at the bullet itself. Loc makes the object to teleport which cases Physics problems.
  • You should mention that ALL parents needs to have a scale of (1,1,1) to avoid transformation issues.
  • Optional: I suggest to change the display representation of the Empty at the Object Data tab (e.g. to Single Arrow) it is easier to see where it points too. Indeed this needs the bullet to get the correct initial velocity.

My recommends to the step-by-step tutorial:

  • it is fine as it is except: The gun and the empty should be at layer 1. Only the bullet should be at layer 2. (see step 4)

1…5. are more sections rather than steps. You could add a heading that describes what it means e.g.

1&4.Gun Setup
2&3.Bullet Setup
5.Shooting Logic

Within these sections make one entry per step rather than 5 steps at one line. This is much easier to read.

If you add logic bricks you already have to decide what type you want. I suggest to write “Add an XXX Actuator” rather than “Add an actuator. Make it XXX”. This belongs to 2.49 as you had to set the type after adding.

I hope it helps

A slightly updated version that takes into account things said from above plus a few extras :D:

Press SPACE to fire bullets, press RETURN to fire a rocket. The gun has an ammo counter that prevents bullets / rockets being fired when the ammo is expended (this amount is set via properties).

The bullets and rockets do different amounts of damage, and when the targets health (also set by a property) = 0 it ends itself with a bang! The bullet and rocket objects are set to ghost (so they do not hit each other).

I also used some expression logic bricks (since very few people use them).

But a nice small tutorial- keep at it!


logic_gun.blend (368 KB)

thanks for all your ideas, complements, and suggestions. :slight_smile:

This way is for people just starting out. You need to use rays, messages and properties.