placeObject()
Purpose
Place a 3D object
Description
Place one of the predefined 3D objects in the screen buffer at the specified location and scale
Syntax
handle = placeObject( object, location, scale )
Arguments
handle handle of the placed 3D object
object handle of the 3D object or predefined object (cube, sphere, pyramid, cone, cylinder, wedge and hemisphere)
location position vector in 3 dimensional space { x, y, z }
scale scale vector in 3 dimensional space { x, y, z }
Example
obj = placeObject( cube, { 0, 0, 0 }, { 2, 2, 2 } )
setObjectMaterial( obj, red, 1, 1 )
setCamera( { 5, 5, 10 }, { 0, 0, 0 } )
light = pointLight( { 0, 4, 2 }, white, 100 )
x = 0
loop
clear()
c = controls( 0 )
setLightPos( light, { x, 4, 2 } )
if c.left then
x = x - 0.2
endIf
if c.right then
x = x + 0.2
endIf
rotateObject( obj, { 1, 1, 1 }, 0.5 )
drawObjects()
printat( 0, 0, "Use left and right arrows to move light source: ",x )
update()
repeat
Associated Commands
drawObjects(), loadModel(), objectPointAt(), removeObject(), rotateObject(), setObjectMaterial(), setObjectPos(), setObjectScale()