This function applies a force to an entity.
--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
local camera = Camera:Create()
camera:SetRotation(35,0,0)
camera:Move(0,0,-8)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)
--Create the ground
local ground = Model:Box(10,1,10)
ground:SetPosition(0,-0.5,0)
ground:SetColor(0,1,0)
--Create a shape
local shape = Shape:Box(0,0,0, 0,0,0, 10,1,10)
ground:SetShape(shape)
shape:Release()
--Create a model
local model = Model:Box(10,1,1)
model:SetPosition(0,0.5,0)
model:SetColor(0,0,1)
model:SetMass(1)
--Create a shape
local shape = Shape:Box(0,0,0, 0,0,0, 10,1,1)
model:SetShape(shape)
shape:Release()
--We're going to add a force (0,0,100) at the position (5,0,0)
--This will push a point on the right side of the object away from the camera
model:AddPointForce(0,0,100,5,0,0)
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
Time:Update()
world:Update()
world:Render()
context:Sync()
end