SetPosition
Sets the position of an entity in 3-dimensional space, using local or global coordinates.
Syntax
- SetPosition(number x number y, number z, bool global = false)
- SetPosition(Vec3 position, bool global = false)
Parameters
- x: X component of the specified position.
- y: Y component of the specified position.
- z: Z component of the specified position.
- position: the position to set.
- global: indicates whether the position should be set in global or local space.
Remarks
An entity can be positioned in local or global coordinates. Local coordinates are relative to the entity parent's space.
If the entity does not have a parent, local and global coordinates are the same.
Leadwerks uses a left-handed coordinate system.  This means that if you hold your left hand as shown below, your middle finger, index finger, and thumb will point in the directions of the X, Y, and Z axes, respectively.
Example
--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,-6)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)
--Create a model
model = Model:Box()
while true do
    if window:Closed() or window:KeyHit(Key.Escape) then return end
    model:SetPosition(Math:Sin(Time:GetCurrent()/10.0),0,0)
    Time:Update()
    world:Update()
    world:Render()
    context:Sync()
end