Game Engine - Motion
If you have a suggestion for a new tutorial or questions about Blender 3D please go to the
Forum
| Other Tutorial Options: | Required Downloads | Languages |
 |
|
français |
For this tutorial I will have the worded directions along with the exact
keystrokes it takes to get the step done. If you are fluent enough with
Blender you may not have to look at the keystrokes line. Each step within
the keystrokes line will be highlighted like this: Example. Arrows will
indicate that you should be following a menu path.
For this tutorial it is necessary that you download the file that goes with this. Download it now if you haven't
already. When you open the .blend file Blender should open up and there should be a scene that looks like
this one.

If you aren’t already, you should first go to the Logic buttons. This is the little purple Pac-man symbol or
just hit F4.
--
F4
The first thing that we are going to do is first simulate movement through the camera. So select the camera.
Down in the buttons area there should be an actor button in the top-left corner, this enables the camera for
use in the game. After you have done that, hit add for each of the three columns. There are called Sensors,
Controllers, and Actuators.
-- Select the
Camera, Click on
Actor, and Click
Add for all three columns
Then, as shown above, connect the dots between these columns. This makes sure that your actions cause a
response when you are in game mode. You will understand better in a bit.
Let’s just say we want to go forward first. Usually on the computer, to go forward we use the up arrow.
We are going to do the same thing here. Click on “Always” under the first column and select “Keyboard”
from the pull out list. Some new buttons should appear. Next to “Key” there is a blank rectangle. Click
on it and hit the up arrow. Now your up arrow will be what causes an action to be defined soon.
-- Click
‘Always’ and select
Keyboard, Click on the
rectangle next to Key,
Up Arrow
Now over in the actuators column we have motion selected. This means that when we hit the up arrow, the
camera is going to move. We just have to tell it which way to move. We will change one of the settings in
the row labeled as “dloc”. This means change in location. The first column is in the ‘x’ direction, second
in the ‘y’ direction, and third is in the ‘z’ direction. Since the ‘L’ on the right of these columns is
selected the directions are local compared to the camera. Change the ‘z’ direction in the ‘dLoc’ row to
‘-0.1’.
-- Change the
Z value in ‘dloc’ to 0.1
Now you can try it this out in the game engine. In order to see through the camera in the game, you must be
in the camera view before you try to test it out. If you don’t you will not be able to see the camera or be
able to tell if this is going to work. So go into camera view and then hit ‘p’.
--
0,
P
Now you are in game mode. If you hit the forward button, the camera should go forward. You cannot do
anything else though. This is because we did not set anything else up yet. For every button or action
that you want in your game you have to have a separate sensor. Right now we only have the Keyboard up
arrow as a sensor. Another piece to note is that is you hit the up arrow enough, you will go right through
our yellow doorway. Let’s fix this. So to get out of game mode
hit escape.
In our logics buttons area, we want to add another action for our camera. This time we will go backwards.
To make some more space click on the little yellow triangle that it pointing down under the add button. Now,
just as before, hit add for all three of the columns and connect the dots.
-- Click the
yellow triangles, click
‘add’ for the three columns,
Connect the dots
You can see the buttons clicked in the image below.
In our new sensor area, click on ‘always’ and select ‘keyboard’. Click on the space next to ‘key’ and then
press the down arrow. In order to make the camera to move backwards we must cause it to do the opposite as
we did for forwards. This means instead of going ‘-0.1’ in the z-direction we want to move 0.1 in the
z-direction. Once you have change the z-direction to 0.1 in the ‘dloc’ row, we can test it out in game mode.
-- Click
Always, select
Keyboard, Click the
space next to ‘Key’,
Down arrow,change the
z-direction in ‘dloc’ to 0.1
Now when you test it out you should be able to go forwards and backwards using the up and down arrows.
But if we go far enough we still go through our yellow door. Let’s fix that now. Hit escape to get out
of game mode.
Make sure your camera is selected and go back into the Logic Buttons. This time we will click on ‘Dynamic’.
When the buttons for this appear we will want to make sure the radius is 1. Now the camera should not go
through our door. Go into Game mode and see what happens now.
-- Click
‘Dynamic’,
p
Now the camera will bounce off of the door rather than go through it.
Now you can add as many other motions as you like. If you want to turn your camera, you will want to
change to ‘dRot’ for your left and right arrows. If you just change the ‘dloc’ the camera will not turn
and you will not be able to see where you are going.
See the next tutorial in the series!
Game Engine - IPO Curves
If you have a suggestion for a new tutorial or questions about Blender 3D please go to the
Forum