setCamera()
Purpose
Set the position of the camera in 3D space
Description
Positions the camera in 3D space and where it is pointing to
Syntax
setCamera( location, target )
Arguments
location A position vector in 3 dimensional space { x, y, z } where the camera is located
target A position vector in 3 dimensional space { x, y, z } where the camera is pointing
Example
obj = placeObject( cube, { 0, 0, 0 }, { 2, 2, 2 } )
setObjectMaterial( obj, red, 1, 1 )
x = 5
y = 5
setCamera( { x, y, 10 }, { 0, 0, 0 } )
light = pointLight( { 0, 4, 2 }, white, 100 )
loop
clear()
c = controls( 0 )
setCamera( { x, y, 10 }, { 0, 0, 0 } )
if c.left then
x -= 0.2
endIf
if c.right then
x += 0.2
endIf
if c.up then
y += 0.2
endIf
if c.down then
y -= 0.2
endIf
drawObjects()
printAt( 0, 0, "Use arrows to move camera" )
printAt( 0, 1, "x = ", x, " y = ", y )
update()
repeat
Associated Commands
drawObjects(), placeObject(), pointLight(), rotateObject(), setObjectMaterial()