Blender 3D: Noob to Pro/Your First Test
The Blender Game Engine is an interesting feature of Blender. It is basically a 3D environment in which 3D objects move around and react to each other upon contact. One common application is to recreate 3D architectural tours.
In this tutorial, you will learn the basics of object collision within the Blender Game Engine (BGE). From Blender games to use in animations, the bullet physics engine offers a massive number of possibilities. The tutorials found within this wikibook on the subject of the BGE are generally focused on game creation, but the concepts taught within can be applied to a multitude of situations.
As a start, we will teach you to make a ball roll realistically down the hill using Blender's game engine.
Adding the Hill
First, make a plane, then switch to Edit mode (TAB), and multi-subdivide it with 2 cuts (WKEY → Subdivide Multi → 2). Next, enter face select mode (CTRL+TAB → Faces) to drag the center face up, in order to form a rough outline of a hill. Add a subsurf modifier (in the edit buttons) to about 3, then apply. You should now have a serviceable, but small, hill. Scale the hill up (SKEY) by about 10 times, and we're ready to add the ball.
- You can also use a 3*3 grid.
- Delete the original cube first.
- The subsurf modifier is not essential.
Creating the Ball
Now, add an icosphere (SPACE → Add → Icosphere) and relocate it to be just above the hilltop (GKEY or use the translate widget by pressing CTR+ALT+G). Let's change the color of the sphere so we can differentiate it from the plane. Go to the material buttons (with the sphere selected) and click on the white panel beside the COL value. In the color selection wiget that appears, change its color to a bright red.
Next we need to make the Physics engine iterate over it. With the sphere selected, go to the logic buttons (the little purple Pacman-icon). NOTE: In Blender 2.5 and above the Logic Buttons are gone. In order to have the 'Actor' button, click on the button showing 'Blender Render', and select 'Blender Game' Engine. Then go to the physics tab in the buttons menu. There you will see the 'Actor' Button. You will see a button in the top left that says Actor. Press it. Now select from the selection box beside of the "Actor" button Rigid Body. This makes the ball roll, instead of staying completely upright the entire time. You will see a bunch of settings available now. Change Radius to 2. This changes size the physics engine thinks the ball is. You notice a dotted circle around the object; this is the boundary. Now change the Radius back to 1. You now have your first Blender game ready to go.
- Make sure you are in object mode first before you add any object.
- F4KEY is the shortcut to the logic panel.
Testing your game
Now the time has come for the first test of our game.
- Add a light source well above the hill (SHIFT+AKEY → Lamp → Lamp). Align in front view (NUM1)
- Press NUM5 to switch to Perspective mode, which gives a realistic view, rather than a view in which objects stay the same size with distance (be sure to switch back to Orthographic view when you are editing again using NUM5)
- Enter textured mode (ALT+ZKEY -- press ZKEY to switch back to solid view mode)
- Switch into side view (NUM3) and press NUM8 several times to get a good perspective on the ball.
- Press PKEY to play the game (Make sure you are in Object mode (TAB)
- Press P to start testing the game. You should see the red ball drop onto the hill.
- Press ESC to quit testing the game
Video capturing your game
When you press the PKEY or click game, start play, Blender will play it using the 3D view. Many rendering features are not shown in this 3D Window and it does not render the view in order to get good pictures with textures and lighting. You must capture your object that keep on changing(the actor) so that it can be animated.
View -> click View button , -> next step / -> alternative step RMB -> right mouse button IKEY -> press the I key on keyboard
Split window, IPO Curve Editor View, Game, Record Game Physics to IPO,
object mode, RMB(select actor), IKEY/select key frame, Loc(location of actor object only),
PKEY( play game), ESCKEY(stop game)
scene(F10), output, f:\animation\ball (your file name), stamp, time, date, draw stamp, format,(choose your output format)
anim, end(ending frame), 270, step, 10(for testing), ANIM/Render, Render Animation/CTRL F12
With the knowledge acquired in this tutorial, there are many things you could accomplish within the Blender Game Engine, although the majority of them would require more knowledge. So read on, and work your way through the multitudinous seas of tutorials (That is, two).