function main () -- get the scene in the global scope -- scene = Scenes.get("World") -- load up a sphere -- scene:import("samples/shapes/shapes.xsg:Sphere") -- get a reference to the sphere's transform -- sphere_transform = Resources.getTransform("Sphere"); -- get a reference to the sphere's geometry -- sphere_geometry = Resources.getGeometry("SphereShape"); -- make a new entity to represent our physical sphere -- entity = Entities.create("PhysicalSphere"); -- Bind this entity with our sphere's transform. -- -- We do this because the physics simulation -- -- affects the transform in order to move the -- -- sphere around. -- entity:bind(sphere_transform); -- enable physics on the entity -- Entities.enablePhysics(entity); -- set the physical sphere's geometry for collision -- Entities.physicalGeometry(entity):useMesh(sphere_geometry); -- Create and bind a new script which will continually -- -- update the physical sphere entity. -- -- This script is included with Geos, click here to -- -- see what it looks like. -- script = Scriptsystem.bindScript("utility/scripts/physics_updater.lua", entity); -- Start the script -- Scriptsystem.startScript(script); end