setLightPos()
Purpose
Set the position of a light source
Description
Set the position of a light source to the specified value
Syntax
setLightPos( light, position )
Arguments
light handle of the light source
position A position vector in 3 dimensional space { x, y, z } where the light source is located
Example
obj = placeObject( cube, { 0, 0, 0 }, { 4, 0.1, 4 } )
lightpos = { 0, 0, 0 }
light = pointLight( lightpos, white, 50 )
setCamera( { 0, 4, 8 }, { 0, 0, 0 } )
loop
clear()
c = controls( 0 )
// Move the light position using the joysticks
lightpos += { c.lx, c.ry, -c.ly } * 0.1
// Restrict height control of light position
lightpos.y = clamp( lightPos.y, 0.1, 10 )
setLightPos( light, lightPos )
drawObjects()
printAt( 0, 0, "Use Joy-Con Control Sticks to adjust light position" )
printAt( 0, 1, "Light X Position: " + str( lightPos.x ) )
printAt( 0, 2, "Light Y Position: " + str( lightPos.y ) )
printAt( 0, 3, "Light Z Position: " + str( lightPos.z ) )
update()
repeat
Associated Commands
pointLight(), pointShadowLight(), removeLight(), setAmbientLight(), setLightBrightness(), setLightColour(), setLightDir(), setLightSpread(), spotLight(), worldLight(), worldShadowLight()