Game Development Reference
In-Depth Information
Creating a floor
Now that your sandbox is initialized and hooked into Lua, we can start adding some basic
geometry and lighting. The sandbox package exposed to Lua provides a CreatePlane
function that will create a plane mesh specified by a width and length. A corresponding
physics half-space will also be created and added into the physics simulation.
Tip
A physics half-space is a plane that expands infinitely in both the x and z directions.
Once a plane object has been created, we'll assign an Ogre material through the
Core.SetMaterial function to give the plane a texture defined within media/ma-
terials/base.material .
Tip
The sandbox is set up to handle standard diffuse, specular, and normal mapped material
types. New materials can be added to the media/materials/base.material file.
In this case we'll assign the Ground2 Ogre material to our newly created plane.
Sandbox.lua :
function Sandbox_Initialize(sandbox)
local plane = Sandbox.CreatePlane(sandbox, 200, 200);
Core.SetMaterial(plane, "Ground2");
end
If you run the sandbox at this point, you might expect to see the plane you created, but
you'll see a black screen instead. Without any lighting in our sandbox, even though our
plane had been created, we won't be able to see it yet.
Search WWH ::




Custom Search