Jump to content

Blender 3D: Noob to Pro/Your First Test

From Wikibooks, open books for an open world

Introduction

[edit | edit source]

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. Note: Blender game engine doesn't exist now, so if you don't want to learn all this game engine part consider skipping the whole game engine section

Adding the Hill

[edit | edit source]

First, make a plane, then switch to Edit mode (TAB), and multi-subdivide it with 2 cuts (WKEYSubdivide Multi → 2). Next, enter face select mode (CTRL+TABFaces) 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.

Noob note:

  1. You can also use a 3*3 grid.
  2. Delete the original cube first.
  3. The subsurf modifier is not essential.

Creating the Ball

[edit | edit source]

Now, add an icosphere (SPACEAddIcosphere) 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.

Noob Note:

  1. Make sure you are in object mode first before you add any object.
  2. F4KEY is the shortcut to the logic panel.

Testing your game

[edit | edit source]

Now the time has come for the first test of our game.

  1. Add a light source well above the hill (SHIFT+AKEYLampLamp). Align in front view (NUM1)
  2. 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)
  3. Enter textured mode (ALT+ZKEY -- press ZKEY to switch back to solid view mode)
  4. Switch into side view (NUM3) and press NUM8 several times to get a good perspective on the ball.
  5. Press PKEY to play the game (Make sure you are in Object mode (TAB)
  6. Press P to start testing the game. You should see the red ball drop onto the hill.
  7. Press ESC to quit testing the game

Rolling ball tutorial screen capture

Video capturing your game

[edit | edit source]

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

Conclusion

[edit | edit source]

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).

Extra Tutorials

[edit | edit source]

Making a Basic Game: Link, The State Actuator: Link, Blender Game Engine Mouse Follow: Link, Blender Bullet Physics: Link, Domino Game: Link, Rag Doll: Link