This function creates and returns a unique duplicate of the specified 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 a model
local model1 = Model:Box()
model1:SetPosition(-1,0,0)
model1:SetColor(0,0,1)
--Create a copy
local model2 = tolua.cast(model1:Copy(),"Model")
model2:SetPosition(1,0,0)
model2:SetColor(0,1,0)
--Lets modify some vertices to show the copy is unique
local surface = model2:GetSurface(0)
surface:SetVertexPosition(0,-0.5,-2,-0.5)
surface:UpdateAABB()
model2:UpdateAABB(Entity.LocalAABB)
model2:UpdateAABB(Entity.GlobalAABB)
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
Time:Update()
world:Update()
world:Render()
context:Sync()
end