Game Development Reference
In-Depth Information
Creating sandbox objects
If you want an Ogre mesh to be simulated with physics, you can create a sandbox object in-
stead. Sandbox.CreateObject will automatically generate a convex hull for any Ogre
mesh and allow the object to be simulated with physics.
Note
As generating a physics representation for an arbitrary mesh happens at runtime, complex
meshes might increase the load times of your sandbox. Internally, bullet physics creates a
simplified convex hull that approximates the Ogre mesh instead of being an identical one-
to-one mapping. Keep this in mind, as the physics representation of any Ogre mesh will al-
ways be an approximation and never an exact replica of the original mesh.
We can now convert the block mesh we created earlier to a full-fledged physically simu-
lated object.
Sandbox.lua :
function Sandbox_Initialize(sandbox)
...
local object = Sandbox.CreateObject(
sandbox, "models/nobiax_modular/modular_block.mesh");
-- Set the mass of the block in kilograms.
Core.SetMass(object, 15);
Core.SetPosition(object, Vector.new(0, 1, 0));
Core.SetRotation(object, Vector.new(0, 45, 0));
end
Search WWH ::




Custom Search