View Functions  (Animation Script)

View function are included to get/set view position and angle. 

Parameter Modifiers
( - ) Use negative value for function parameter

Notations

VERTEX - Declared VERTEX variable / object center from named Object variable / surface normal from named Surface variable
float - Scalar floating point constant or VERTEX variable component (.x/.y/.z)
View Position - Refers to location in 3D space a frame is rendered from
View Angle - Angle frame is rendered from in degrees.   
View Vector - 3D normal vector representing direction frame is being rendered from


Functions Description and parameter type variations
GetViewPos Gets View position, a 3 component VERTEX value

GetViewPos(VERTEX V)
   V.x = X View Position
   V.y = Y View Position
   V.z = Z View Position

GetViewAngle

Gets View Angle in degrees

GetViewAngle(VERTEX V)
   V.x = X View Angle  (tilt, "look" up/down angle)
   V.y = Y View Angle  (pan, "look" left/right angle)
   V.z = Z View Angle  (diagonal angle)

GetViewVector Gets a normal vector representing View direction vector

GetViewVector(VERTEX V)
   V.x = X View Vector
   V.y = Y View Vector
   V.z = Z View Vector
SetViewPos Sets View Position

SetViewPos(VERTEX V)
   X View Position = V.x
   Y View Position = V.y
   Z View Position = V.z

SetViewPos(float x, float y, float z)
   X View Position = x
   Y View Position = y
   Z View Position = z
SetViewAngle Sets View Angle

SetViewAngle(VERTEX V)
   X View Angle = V.x
   Y View Angle = V.y
   Z View Angle = V.z

SetViewAngle(float x, float y, float z)
   X View Angle = x
   Y View Angle = y
   Z View Angle = z

Examples

Named Surface in example, RectTop

VERTEX ViewPos, ViewAngle, ViewVector

GetViewPos(ViewPos)

//Move view position 'forward' 20 units along view vector
ViewPos.TranslateV(ViewVector, 20)
//Update view position
SetViewPos(ViewPos)
//Show the frame
Wait()

GetViewAngle(ViewAngle)
//pan left 10 degrees
ViewAngle.Add(0, -10, 0)
//Update view angle
SetViewAngle(ViewAngle)

GetViewVector(ViewVector)
//Setup a 'billboard' surface
//Align surface to opposite view vector direction so it is facing the viewer in the frame
RectTop.AlignToAxis(-ViewVector)
//Show the frame
Wait()