From model to animation
Making the path
We now have a car but we want to be able to move this car around the countryside using the Blender Game Engine. With the car model that we just made, go to Top View with Num 7. We load the third layer by pressing 3 (the number 3 on top of the keyboard and not the numeric keypad). You can also select the buttons at the bottom of the 3D window.
The numbers on top of the keyboard control the layers in the Blender environment. Think of the layers as a kind of transparency containing objects that we add or remove over our scene.
On the third layer, we have a blank 3D window. This will permit us to build a course without modifying our car. Add the grid by pressing Spacebar -> Add -> Mesh -> Grid. Click Yes to the X res : 32 and Y res : 32 question.
We now have a grid...
that we scale with the S key. While everything is selected, tab on the Face select mode. A black dot will appear in every square inside the grid that will help us to quickly make a path inside the grid mesh.
We de-select everything by pressing A. After that, we box select with B but this time we will press twice (B-B). We now have a round pointer instead of the regular cross-hair. We change the diameter of the target with the MMB so that it will fit inside the squares of our grid. Making a path is simply a matter of holding the LMB and moving over the the grid. Once we have completed our course, we right-click RMB to go out of the select mode.
Switch to the Front View with Num 1. Extrude, E, the selection down on the Z axis for about 1 unit. This will transform the path into a track for our car.
We now have a simple track course.
We can now paint the mesh. Press Tab to go to the Object Mode. Press F to go to the UV Face Select mode. You should see the UV Face Select mode icon; the grid is now white and the selected surfaces pink.
We will repeat the steps used when we painted our car: In UV Face Select mode, locate the Texture Face panel. Choose a brownish color and click on the Set VertCol button.
We will now reverse the selected area so that only the faces that were previously unselected become the ones that are selected and permit us to paint the "country".
Go back to Edit Mode with Tab. Locate the Select Swap button in the Mesh Tools 1 panel (you may have to move around the panels with MMB)
Go back to UV Face Select with Tab. Choose a green color and the course is complete.
Merging the car and path
We merge the car by pressing the layers buttons. You can use the 1-2-3 numbers at the top of the keyboard.
Your car will be in the middle of the course.
Select the car, RMB, and place it on top of the surface with G.
Compared to our path, the car is way too big and must be scaled back with S. Reduce it so that it will fit inside the path and place it at a starting point.
We are now set to configure the gamelet and apply physics used for driving the car.
Setting the camera
We now place the camera just behind the car. To help you have a good view of the car, go to Num 0, the camera view.
We select the camera RMB, then select the car with Shift and RMB.
We associate the camera with the car so that when the car will be moving in the Game Engine, the camera will follow. For this, we press Ctrl-P and answer Yes to the question OK? Make Parent; we are creating a parent-child relationship between the two objects. From now on, the camera will follow the car whenever the car is moved.
Applying the physics
We have the car, the camera and the set and now it's time for action. We will use logic bricks to program movements to the car. Select the car with the RMB'. We go to the Game Logic Window with F4 or by clicking on the Pac Man Button
Toggle the Actor button, then Dynamic.
Selecting the Bounds button and keeping the default values will force the car to react to the laws of physics. Locate the radius, go into Solid Mode and adjust the white dotted line so that it just fits around the car.
Action!
The camera and the physics have been applied to our car. Now we will configure the movement. On the right side of the panel, you will see three sets of boxes; Sensors, Controllers and Actuators. Those will be use to control the movements of our car. We start by adding a plane to the Sensors button.
You click on the Always box and select Keyboard. Toggle the button on the empty box beside Key. The button will stay selected and you will see the message Press a key. Select the Up Arrow on the keyboard.
On the right of the Sensor panel, you see a little ball. Click and hold the LMB and move the mouse. You'll see a black line coming out of the ball that follows the mouse pointer. Go over the Controllers panel and release the LMB over the left-hand side ball of the Controllers button.
We keep the default values for the Controllers and concentrate our attention on the Actuators panel. We connect the controller to the actuator with the LMB. On the dLoc, click on the left-hand arrow and select -0.10, this will be the amount of movement in one direction that the Up Arrow key will control. Later on, you can easily edit the value for a more appropriate one.
That's it! You've configured a movement in the Game Engine environment.
Press Num 0 for the camera view. Press P to go into the game engine environment and press the Up Arrow. Depending on where you put the car on the grid, it may go in the wrong direction. To correct this, press Esc to escape from the game engine. Go to Top View with Num 7 and compare the position of the front of the car with the reference axis in the lower left corner. In our example, the forward movement is negative to the X axis.
Once you've corrected any errors, it's easy to repeat the process and configure the backward movement (dLoc=0.10 in our case) that correspond to the Down Arrow.
Making the car turn right and left is easy; we will use the dRot toggle switch instead of dLoc, and give a rotation of 0.10. You do this for Left Arrow and Right Arrow.
The gamelet is now finished !!! You can now move the car around in your game.
Congratulations. You've learned a lot about advanced functions in Blender.






















