Game Development Reference
In-Depth Information
Adding meshes to the sandbox
An Ogre mesh is simply a visual piece of geometry within the sandbox without any physics
representation. To add an Ogre mesh to the sandbox, simply call
Core.CreateMesh
and
pass in the location and filename of an Ogre mesh file.
Setting the position and rotation of a mesh can be done through the
Core.SetPosition
and
Core.SetRotation
functions:
Sandbox.lua
:
function Sandbox_Initialize(sandbox)
...
local mesh = Core.CreateMesh(
sandbox, "models/nobiax_modular/modular_block.mesh");
Core.SetPosition(mesh, Vector.new(0, 1, 0));
Core.SetRotation(mesh, Vector.new(0, 45, 0));
end
The rotation function expects a vector of angles expressed in degrees. For example,
Vect-
or.new(0, 45, 0)
will rotate the mesh 45 degrees around the
y
axis.