Graphics Programs Reference
In-Depth Information
Figure 19.6
Put the 3D window into top view and add a plane to the
scene. Scale the plane up six times, go back to front view,
and move the sphere up above the plane (Figure 19.4). Move
to user perspective view (number pad 0 then number pad
5 twice). Press the P key to see the sphere descend and
sit on the plane, and press Esc to go back to object mode
(Figure 19.5). It is time to tell Blender when and how we
want our actor to move. In the logic editor window at the
bottom of the screen, you should see three logic blocks:
“Sensors,” “Controllers,” and “Actuators” (Figure 19.6). The
sensor is what will trigger an action, so click on the “Add
Sensor” drop down menu to see the options (Figure 19.7).
The controller is what will control the action; click on “Add
Controller” to see these options (Figure 19.8). Finally, the
actuator tells the actor what to do, so click on “Add Ac-
tuator” to see these options (Figure 19.9). We will choose
some settings and make something happen to give you an
idea how this all works. In the “Sensors” logic block, click
“Add Sensor” and select “Mouse.” Therefore, our mouse
will be the device we use to trigger the action. If you want
to change your mind about this, click on the drop down
menu and select something else. For now, let's stick with the mouse.
Where it says “Mouse Event” in the “Sensor” panel, you should select what part of
the mouse will be responsible for the trigger. Click “Left Button” to see your options,
but stick with “Left Button” as the final selection. In the “Controller” logic block, click
“Add Controller” and select “And.” In the “Actuator” logic block, click “Add Actuator”
and select “Motion” since we want our actor to do some moving about. Leave the “Mo-
tion” type as “Simple Motion” and you should see two slots: “Loc” (location) and “Rot”
(rotation) with “X,” “Y,” and “Z” values (Figure 19.10). “X,” “Y,” and “Z” indicate the
axis and the value will give the speed of the action. Enter “Loc Y” as 0.20, which tells
the actor to move along the y- axis at a speed of 0.20—note that this is in the positive
y direction. To move in the opposite direction, enter -0.20. The last step for now is to
connect the logic blocks. Click on the little black dot at the RHS of “Sensor” and drag
over to the little circle next to “Controller,” then do the same between “Controller” and
“A c t u a t o r .”
Time for a test run. Put your mouse in the 3D window and press the P key. Give your
LMB a click and you will see the sphere move. It may not be in the direction of the pointy bit
Figure 19.7
Figure 19.8
Figure 19.9
 
Search WWH ::




Custom Search