| Other Tutorial Options: | Required Downloads |
Creating a first person shooter is a very popular topic for those new and old to the Blender
Game Engine. In many games, such as in the Halo series, a person can walk up to a weapon on the
ground and pick up the weapon by pressing a button. Now I am proud to tell you that this can be
done in the Blender Game Engine without Python. Just follow this tutorial and you will be able
to pick up any weapon or object your heart desires.
The scene I have set up will be very simple. To make this work a little better I suggest you
download the .blend file. To make it appear as if you are picking up the gun this tutorial will
involve the use of IPO curves and movement, which are both in tutorials I have previously made.
If you are not comfortable going forward with those topics please go to the tutorials page and
look over those tutorials first.
Once you have downloaded the .blend file and have opened it up in Blender, you should see two
blue (and very basic) guns. One is parented to the camera and then there is a plane to act as
the floor. The first thing we will do with this scene is animate the picking up of the gun.

This is going to be just a simple rotation of the gun so that it appears in the camera screen as if you are holding it. So go into side view by hitting ‘3’ and get a good view on the gun parented to the camera. Then go and change your viewing screen layout to ‘Animation’. It should look like this:

First go to frame 50 and hit ‘I’ then select ‘LocRot’. This will be the gun in its visible
position. After that select the gun, hit ‘R’ and type in 45. This will rotate our gun 45 degrees
and out of the sight of the camera. Go to frame 1 and hit ‘I’ and select ‘LocRot’. Now we have
the animation of picking up our gun.
Next we have to make the camera move. This will allow us to get in range of the weapon to pick
it up. You can get out of the ‘Animation’ layout and go back to the ‘Modeling’ layout now if you
like. Select the camera and hit ‘F4’, this opens up the Logic buttons. Under each of the columns,
(sensors, controllers, and actuators) hit ‘Add’ four times. Now just copy the settings below.
If you need more of an explanation on movement you can go to the Game Engine: Movement tutorial.

With those settings you should be able to move around our simple scene with the arrow keys. If you don’t like using those keys you are free to change them as you like. Now we can use the animation we just made to simulate picking up the weapon. This time you will select the gun parented to the camera and go into the logic buttons by hitting F4 if you are not already there. Under each of the three columns hit add and just copy the settings below. We will use the enter key to start the animation. If you need more of an explanation on using IPO curves in the game engine you can go to the Game Engine: IPO curves tutorial.

Now we have our camera move around and when we hit enter our weapon will either appear or
disappear. Now we just need to make it seem as if we have picked up the weapon in the center of
our scene. The first step is to make the weapon we are picking up disappear, and the second is
to only allow the player to pick up the weapon when they are close enough to it. Let’s start by
making the weapon in the center of our scene disappear.
To pick up the weapon the player must hit the ‘Enter’ button. This also triggers the animation
with the parented gun. So to make the weapon disappear we will use the ‘Enter’ button. If you
haven’t already, select the gun in the center of our scene and get into the Logic buttons. Now
hit ‘Add’ for all three of the columns. You can see the settings I chose below.

As you can see I just make the sensor setting a keyboard setting with the ‘enter’ key, or
‘Ret’ as it shows. What makes the gun disappear is the ‘Visibility’ setting. When you change
the setting for visibility to invisible the gun will become invisible. If you test out our
scene by hitting ‘P’ you can see the gun disappear and it seems as if you picked up the weapon
as it comes into view.
This is great but we would have some serious issues if this was a real game. You could just
pick up the weapon when ever you wanted. Now we can set a ‘Near’ sensor so that the animation
will only work when the player hits Enter and they are near the gun in the center of the scene.
With the gun in the center of the scene still selected hit ‘Add’ only in the Sensor column.
Then connect it as you see below.

Now you have to be within 2 units AND (as signified by the center column) you have to hit the
‘Enter’ button to cause the gun to disappear. If you chose ‘OR’ for the center column you would
only have to get close or hit enter to make it work. You can test it out if you like.
Now we have to make the gun parented to only appear when we get near the gun at the center of
our scene. Now all you have to do is the exact same thing we did with the last gun and the ‘Near’
setting. Now that we have done that we can test our game out again. As you can tell this works
perfectly. But once again we would run into another problem if this were a real game.
If there is any other object that is an ‘Actor’ in the game and the player is standing near
it and enter is pressed the gun will appear. We only want the gun to appear when we are near
the weapon on the ground. To prove this to you, add a cube to the scene and put it somewhere
in the scene, but make sure it is a good distance away from the gun in the middle of our scene.
With the cube selected go to the Logic buttons and hit ‘Actor’.

Hit ‘P’ to test out your game, go near the cube and hit enter. As you can tell we have a problem. There is a simple fix though. All we have to do is set a property. Select the gun in the center of the scene and hit the ‘Property’ button. In the ‘Name’ area type “Pickup”. Now select the gun parented to the camera and in the ‘Near’ sensor in the property text area type in “Pickup”. Now the near sensor will only activate when the player is near an object with the property name of “Pickup”. Below you can see all the settings.

That is all there is to it. Go ahead and test out your game by going near the cube and hitting enter and then going near the gun and hitting enter. You can also have multiple weapons in your scene by using different property names and multiple IPO animations. So now you can go out there and start your first person shooter game.
If you have a suggestion for a new tutorial or questions about Blender 3D please go to the Forum