setObjectScale()
Purpose
Set the size of a 3D object
Description
Change the scale factor used for the display of a 3D object and hence it's relative size
Syntax
setObjectScale( handle, scale )
Arguments
handle variable which stores the placed 3D object
scale vector containing the scale factors in 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 } )
scale = { 1, 1, 1 }
colin = placeObject( cb, { 0, 0, 0 }, scale )
setcamera( { 0, 10, 10 }, { 0, 5, 0 } )
animID = 6
animlength = animationLength( colin, animID )
animframe = 0
loop
clear()
c = controls( 0 )
if c.up then
scale.x += 0.1
scale.y += 0.1
scale.z += 0.1
endIf
if c.down then
scale.x -= 0.1
scale.y -= 0.1
scale.z -= 0.1
endIf
scale.x = clamp( scale.x, 0.5, 5 )
scale.y = clamp( scale.y, 0.5, 5 )
scale.z = clamp( scale.z, 0.5, 5 )
setObjectScale( colin, scale )
animframe = animframe + 1 / 60
if animframe >= animlength then
animframe = 0
endIf
updateAnimation( colin, animID, animframe )
drawObjects()
printAt( 0, 1, "Use the up and down arrows to increase or decrease the scale" )
update()
repeat
Associated Commands
drawObjects(), loadModel(), objectPointAt(), placeObject(), removeObject(), rotateObject(), setObjectMaterial(), setObjectPos()