Sunday, February 26, 2012

Game Engine Intro

This entry will introduce the mechanics of the game engine built into Blender.  We'll be creating a simple physics simulation of a sphere rolling down a ramp to exemplify this.  So we'll start off with the ramp and floor already modeled.

Switch the renderer to the Blender Game.

Next add a mesh sphere and scale it down to 0.1 or 10cm.  The precise scaling needs to be known for the purposes of manually setting the collider correctly.

In the Physics panel for the sphere set the following attributes to give the sphere a functional presence within the simulation (game).  Note that the radius of in this panel must match the size of the sphere, or the collider will be much larger than the object, and the collision interaction won't look correct.

Finally in the render panel, you can press Start to begin the game (or in this case simulation).

At this point, you should see the view change and the sphere should be affected by gravity and should roll down the ramp.
 You can press Esc at any time to cancel the game-running mode.

Once cool trick, is that if you enable Physics Visualization in the Display section of the Render panel, you can get extra information about your scene displayed while its running.

1 comment: