setObjectPos()
Purpose
Set the position of a 3D object
Description
Set the position of a 3D object in 3D world space
Syntax
setObjectPos( handle, pos )
Arguments
handle variable which stores the placed 3D object
pos vector containing the position 3 dimensions { x, y, z }
Example
cb = loadModel( "Kat Deak/Colin" )
pointLight( { 0.5, 1.3, 2 }, white, 4 )
setAmbientLight( { 0.5, 0.5, 0.5 } )
pos = { 0, 0, 0 }
scale = { 1, 1, 1 }
colin = placeObject( cb, pos, scale )
setCamera( { 0, 10, 10 }, { 0, 5, 0 } )
animID = 6
animlength = animationLength( colin, animID )
animframe = 0
loop
clear()
c = controls( 0 )
if c.left then
pos.x -= 0.1
endIf
if c.right then
pos.x += 0.1
endIf
if c.up then
pos.y += 0.1
endIf
if c.down then
pos.y -= 0.1
endIf
setObjectPos( colin, pos )
animframe = animframe + 1 / 60
if animframe >= animlength then
animframe = 0
endIf
updateAnimation( colin, animID, animframe )
drawObjects()
printAt( 0, 0, "Use arrows to move object" )
update()
repeat
Associated Commands
drawObjects(), loadModel(), objectPointAt(), placeObject(), removeObject(), rotateObject(), setObjectMaterial(), setObjectScale()