Shop OBEX P1 Docs P2 Docs Learn Events
Blender > Part 001 - "Real Time" Keyboard Control of objects — Parallax Forums

Blender > Part 001 - "Real Time" Keyboard Control of objects

GarethGareth Posts: 278
edited 2014-11-09 12:55 in Robotics
Blender > Part 001 - Real Time Keyboard Control.

For us to understand how we can use blender to control our real life robots we have to know a little more about
Blenders Game Logic ......as it is able to control 3D objects in "Real - Time" .


In this example we will use the Keyboard as a means of controlling a cube in "Real-Time" in the Game Logic Gui.


[video=youtube_share;C_ndtFVgGJo]

First select the "Game Logic" Gui
Blender_001_Game_Logic_0000.png

This will bring up 3 selections.
  1. Sensor
  2. Controller
  3. Actuator
1. Select the "Add Sensor" pull down and select "Keyboard" sensor.
Blender_001_Game_Logic_001.png


Hover of the "Key:" box and just press the key you wish to use as your actuator ... In our case "A"
Blender_001_Game_Logic_002_0.png


2. On the Controller selection on the "Add Controller" selection choose "AND"
This will ensure that the command is always activated.... (it is possible to combine multiple sensors together and apply various logic combinations to suit)
(If you notice here ... this is where we will be adding "Python" code in a later walk-through to come.)
Blender_001_Game_Logic_003.png
It will then display so :-
Blender_001_Game_Logic_004.png


3. The actuator selection is the last stage .... choose "Motion" here as we want to Move the Cube.
Blender_001_Game_Logic_005.png


This brings up the motion selections....where you can set up the type and motion increments.
Blender_001_Game_Logic_006.png


Using your mouse "link" the three modules together to form your sensor>controller>actuator links (marked red below)
Also type into the far right (red circle) "-0.10" in the Loc: field, this will be your offset increment .... each time the key A is pressed the box will travel -0.1 blender units on the x axis.
Blender_001_Game_Logic_007.png


Now that the commands have been set up all you need to do now is fire up the "Game-Engine"
Hover over your object screen and .......Press "P"
Blender_001_Game_Logic_010a.png


This enables the game control gui .....to escape at any time press your escape key "Esc"
Press the "A" key and the cube should zip off to the left on the x axis.
Blender_001_Game_Logic_011.png


Now all you need to do is the same for the other 3 directions to get xy control of the cube.
In my case I linked the "R" key to a "Motion" actuator and typed in 0.1 into the Rot. field
Blender_001_Game_Logic_008.png

I have included a video above to show the process an results.Its worth noting here that instead of keyboard control you could also use your mouse instead to control the cube.
Sign In or Register to comment.