[BGE Tutorial] Basic Object Movement

7:31 PM

Today, i want write about BGE Tutorial. I've write Tutorial Game 3D Dasar Pergerakan Objek on my bahasa site. After that, i write it in english for help other people arround world understand with my tutorial. Before following this tutorial, you need to install Blender in your PC / Laptop. In this tutorial i am using Blender 2.67. This tutorial for beginners.

On the first step, please choose Blender Game mode, it make Blender using as Game Engine. This mode not really important for the tutorial. But you will need it for creating game with Blender Game Engine.
Blender Game
Blender Game
I will use default cube for this tutorial. So you can make the cube move when you press a key on keyboard. Before playing with game engine, i think you need to change the window mode to Game Logic.
Game Logic Mode
Game Logic Mode
I assume you already understand the navigation in Blender. If you are not understand the navigation, please learn the navigation first. It will helpfull. Let start the tutorial

Select the cube first and look at the bottom of 3D view window. You will know 3 parts of BGE Logic, they are Sensors, Controllers and Actuators.

  • Sensors are the logic bricks that cause the logic to do anything. Sensors give an output when something happens, e.g. a trigger event such as a collision between two objects, a key pressed on the keyboard, or a timer for a timed event going off. When a sensor is triggered, a positive pulse is sent to all controllers that are linked to it. 
  • The Controllers are the bricks that collect data sent by the sensors, and also specify the state for which they operate. After performing the specified logic operations, they send out pusle signals to drive the actuators to which they are connected.
  • Actuators perform actions, such as move, create objects, play a sound. The actuators initiate their functions when they get a positive pulse from one (or more) of their controllers.

At this time, i want to make the cube move when i press a button on keyboard. For do that, we need to add a Keyboard sensor. On sensor input i add up arrow. Your sensors will look like the image below
Sensors Keyboard
Sensors Keyboard
Let continue by adding the add controller, then connect the sensors to the controllers so that it looks like the image below.
Controller And
Controller And
After that, add motion actuator so that the object can be moved in accordance with what we want. On motion actuator there are several parameters that Loc, Rot, which can be changed on the X-axis, Y and Z. Connect with controllers before attempting to run.
Actuators Motion
Actuators Motion
There is a need to consider before setting motion parameters, namely the position of the axis and the value of the parameters that I will try to explain below.

On Blender navigation, the X axis is represented in red, green Y-axis and Z-axis in blue. If you want to move the object to the right / left use the X-axis, forward / back axis Y and upward / downward axis Z.
xyz axis
xyz axis
For the parameter values ​​do not immediately fill with 1, because the object will move directly away. Blender using Blender Unit, 1 Blender unit size of the box as shown below.
Blender Unit
Blender Unit

Use a positive value to move the object to the right (X) to the front (Y) and to the (Z). And use a negative value to reverse. Add another keyboard according to your wishes :D. To run the game press the button P.

Oh yes, I include the file that contains the 4 buttons keyboard, and their movements. May be used to practice and understand the concept of movement.

Download File on Dropbox

You Might Also Like

2 comments

  1. is there any way to do this with code alone

    ReplyDelete
  2. i am trying to do with logic, i am not enough understand with python

    ReplyDelete

Popular Posts

Subscribe