Blender > Part 001 - "Real Time" Keyboard Control of objects
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
This will bring up 3 selections.
Hover of the "Key:" box and just press the key you wish to use as your actuator ... In our case "A"
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.)
It will then display so :-
3. The actuator selection is the last stage .... choose "Motion" here as we want to Move the Cube.
This brings up the motion selections....where you can set up the type and motion increments.
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.
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"
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.
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
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.
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
This will bring up 3 selections.
- Sensor
- Controller
- Actuator
Hover of the "Key:" box and just press the key you wish to use as your actuator ... In our case "A"
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.)
It will then display so :-
3. The actuator selection is the last stage .... choose "Motion" here as we want to Move the Cube.
This brings up the motion selections....where you can set up the type and motion increments.
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.
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"
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.
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
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.