1.12 Camera .75 1.12.1 Camera.Activate .75 1.12.2 Camera.AttachToParent .75 1.12.3 Camera.Create .76 1.12.4 Camera. Deactivate .76 1.12.5 Camera.EnableAvatarCameraSync .77 1.12.6 Camera.GetlnverseViewMatrix .78 1.12.7 Camera.GetLookAtPosition .78 1.12.8 Camera.GetPosition .79 1.12.9 Camera.GetProjectionMatrix .79 1.12.10 Camera.GetViewMatrix .80 1.12.11 Camera.GetViewPortFOV .81 1.12.12 Camera.GetViewPortZFar .81 1.12.13 Camera.GetViewPortZNear.82 1.12.14 Camera. IsActivated .82 1.12.15 Camera.SetLookAtPosition .83 1.12.16 Camera.SetPosition .83 1.12.17 Camera.SetViewPortAspect .84 1.12.18 Camera.SetViewPortFOV .84 1.12.19 Camera.SetViewPortZFar .85 1.12.20 Camera.SetViewPortZNear .85 Camera Camera.Activate Brief Activates the specified camera. Definition ! Camera.Activate( Camera camera, number transitionTime =0.0 ) Arguments camera - The camera to activate.transitionTime - The time taken to smoothly move from the previously active camera's position, to the specified camera's position. Return Values None. Description Activates the specified camera. Examples ! Camera.Activate( gameCamera, 1.0 ) See Also • Camera. Deactivate • Camera. IsActivated Camera. AttachToParent Brief Links the camera to the given entity so that the camera inherits the entity's transform. Definition Camera.AttachToParent( Camera camera, Entity parent ) Arguments camera - The camera to update.parent - The entity to attach this camera to, or nil to detach the camera. Return Values None. Description Links the camera to the given entity so that the camera inherits the entity's transform. This will override any values set via Camera.SetPosition, or Camera.SetLookAtPosition until the connection is cleared by passing in nil as the parent. If the entity is destroyed then the camera will be unparented. It is not possible at present to specify a local transform offset from the entity. Examples ! Camera.AttachToParent( gameCamera, myEntity ) — connect the camera to myEntity ; Camera.AttachToParent( gameCamera, nil ) — detach the camera from any connected entity See Also None Camera.Create Brief Creates a new 3D camera. Definition Camera Camera.Create( string constructionMethod = nil ) Arguments constructionMethod - How to construct the camera, either nil or "current". Return Values Returns a Camera instance. Description Creates a new 3D camera. This camera is, by default, positioned at the origin (0, 0, 0). If constructionMethod is "current" it creates a new camera with the properties of the currently active camera. Examples gameCamera = Camera.Create( "current" ) Camera.SetPosition( gameCamera, Camera.GetPosition() + Vector4.Create( 0, 1, 0 ) ) See Also • Camera.Activate Camera. Deactivate Brief Deactivates the specified camera. Definition Camera.Deactivate( Camera camera, number transitionTime =0.0 ) Arguments camera - The camera to deactivate.transitionTime - The time taken to smoothly move from the specified camera's position back to the previously active camera's position. Return Values None. Description Deactivates the specified camera. Examples ! if Camera.IsActivated( gameCamera ) then Camera.Deactivate( gameCamera, 1.0 ) | end See Also • Camera.Activate • Camera. IsActivated Camera.EnableAvatarCameraSync Brief Tell the normal Avatar camera to face the same direction as a deactivating custom camera, minimizing the camera transition. Definition i Camera.EnableAvatarCameraSync() Arguments None Return Values Description When enabled, the normal Avatar Camera will sync with any active custom camera to face the same direction. This simply means that when the custom camera is deactivated, the normal Avatar Camera will be facing the same direction, and the magnitude of the transition between the two will be minimized. This defaults to on. It’s rare, and generally not advised to disable this. Examples Camera.EnableAvatarCameraSync(false) See Also None Camera.GetlnverseViewMatrix Brief Get the view to world transform for the currently active camera. Definition Camera.GetInverseViewMatrix(Matrix44 matrix) Arguments matrix - The matrix to set. Return Values None. Description Retrieves the view to world transform for the currently active camera. This can be considered as the world transform of the camera object itself. Examples ! local invViewMat = Matrix44.Create () ; Camera.GetlnverseViewMatrix(invViewMat) See Also • Camera.GetViewMatrix • Camera.GetProjectionMatrix Camera.GetLookAtPosition Brief Retrieves the camera's world space target position. Definition Vector4 Camera.GetLookAtPosition( Camera camera ) Camera.GetLookAtPosition( Camera camera, Vector4 outPos ) Vector4 Camera.GetLookAtPosition () Camera.GetLookAtPosition( Vector4 outPos ) Arguments camera - The camera to query.outPos - (out) The vector to receive the target position. Return Values Returns a Vector4 specifying the world space target position of the camera. Description Retrieves the camera's world space target position. Only the X, Y and Z components of the Vector4 are valid. If no camera is specified it uses the currently active camera. Examples ! camtarget = Camera.GetLookAtPosition( gameCamera ) See Also • Camera.SetLookAtPosition Camera.GetPosition Brief Retrieves the camera's world space position. Definition Vector4 Camera.GetPosition( Camera camera ) Camera.GetPosition( Camera camera, Vector4 outPos ) Vector4 Camera.GetPosition() Camera.GetPosition( Vector4 outPos ) Arguments camera - The camera to query.outPos - (out) The vector to receive the camera position. Return Values A Vector4 specifying the world space position of the camera. Description Retrieves the camera's world space position. Only the X, Y and Z components of the Vector4 are valid. If no camera is specified it uses the currently active camera. Note that inactive cameras are not updated, and therefore if a position is requested for an inactive camera the most recent position available will be returned. For the currently active camera the position will match the translation of the inverse view matrix. Examples campos = Camera.GetPosition( gameCamera ) See Also • Camera.SetPosition • Camera.GetlnverseViewMatrix Camera.GetProjectionMatrix Brief Get the projection matrix for the currently active camera. Definition Camera.GetProjectionMatrix(Matrix44 matrix) Arguments matrix - The matrix to set. Return Values None. Description Retrieves the projection transform for the currently active camera. A script should not assume a particular projection transform format. The projection matrix is used to transform a point from view to clip space. Examples j local projMat = Matrix44.Create() ; Camera.GetProjectionMatrix(projMat) See Also • Camera.GetViewMatrix • Camera.GetlnverseViewMatrix Camera.GetViewMatrix Brief Get the world to view transform for the currently active camera. Definition Camera.GetViewMatrix(Matrix44 matrix) Arguments matrix - The matrix to set. Return Values None. Description This matrix will transform from world space to view space. Examples j local worldToViewMat = Matrix44.Create() | Camera.GetViewMatrix(worldToViewMat) See Also Camera.GetlnverseViewMatrix • Camera. GetProjectionMatrix Camera.GetViewPortFOV Brief Retrieves the vertical field of view for the specified camera. Definition ! number Camera.GetViewPortFOV( Camera camera ) i number Camera.GetViewPortFOV() Arguments camera - The camera to query. Return Values The vertical field of view for the camera, specified in degrees. Description Retrieves the vertical field of view (FOV) for the specified camera. If no camera is specified it uses the currently active camera. Examples I fov = Camera.GetViewPortFOV( gameCamera ) See Also • Camera.SetViewPortFOV Camera.GetViewPortZFar Brief Retrieves the camera's far clip plane. Definition number Camera.GetViewPortZFar( Camera camera ) number Camera.GetViewPortZFar() Arguments camera - The camera to query. Return Values The far clip plane of the camera in units of meters. Description Retrieves the camera's far clip plane. Units are specified in meters. The default far clip plane for a newly created camera is 4000.0. If no camera is specified it uses the currently active camera. Examples ! farz = Camera.GetViewPortZFar( gameCamera ) See Also • Camera.SetViewPortZFar Camera.GetViewPortZNear Brief Retrieves the camera's near clip plane. Definition ! number Camera.GetViewPortZNear( Camera camera ) i number Camera.GetViewPortZNear() Arguments camera - The camera to query. Return Values The near clip plane of the camera in units of meters. Description Retrieves the camera's near clip plane. Units are specified in metres. The default near clip plane for a newly created camera is 0.1. If no camera is specified it uses the currently active camera. Examples ! nearz = Camera.GetViewPortZNear( gameCamera ) See Also • Camera.SetViewPortZNear Camera.IsActivated Brief Determines whether the specified camera is currently active. Definition ! boolean Camera.IsActivated( Camera camera ) Arguments camera - The camera to query. Return Values true if the specified camera is activated, false otherwise. Description Determines whether the specified camera is currently active. Examples 1 if Camera.IsActivated( gameCamera ) then Camera.Dectivate( gameCamera, 1.0 ) | end See Also • Camera.Activate • Camera. Deactivate Camera.SetLookAtPosition Brief Sets the camera's world space target position. Definition ! Camera.SetLookAtPosition( Camera camera, Vector4 target ) Arguments camera - The camera to update.target - Vector4 specifying the world space target position for the camera. Return Values None. Description Sets the camera's world space target position. Only the X, Y and Z components of the Vector4 are used to position the camera. The W component is ignored. Examples 1 Camera.SetLookAtPosition( gameCamera, Vector4.Create( 0, 10, 0, 0 ) ) See Also • Camera.GetLookAtPosition Camera.SetPosition Brief Sets the camera's world space position. Definition ! Camera.SetPosition( Camera camera, Vector4 position ) Arguments camera - The camera to update.position - Vector4 specifying the world space position of the camera. Return Values None. Description Sets the camera's world space position. Only the X, Y and Z components of the Vector4 are used to position the camera. The W component is ignored. Examples ! Camera.SetPosition( gameCamera, Vector4.Create( 0, 10, 0, 0 ) ) See Also • Camera.GetPosition Camera.SetViewPortAspect Brief Sets the aspect ratio for the specified camera's viewport. Definition ! Camera.SetViewPortAspect( Camera camera, number aspect ) Arguments camera - The camera to update.aspect - aspect ratio for the camera's viewport (width / height). Return Values None. Description Sets the aspect ratio for the specified camera's viewport. Examples ! Camera.SetViewPortAspect( gameCamera, 16.0 / 9.0 ) See Also Camera.SetViewPortFOV Brief Sets the vertical field of view of the specified camera. Definition ! Camera.SetViewPortFOV( Camera camera, number fov ) Arguments camera - The camera to update.fov - Vertical field of view for the camera, specified in degrees. Return Values None. Description Sets the vertical field of view of the specified camera in degrees. Examples ! Camera.SetViewPortFOV( gameCamera, 60.0 ) See Also • Camera.GetViewPortFOV Camera.SetViewPortZFar Brief Sets the camera's far clip plane. Definition ! Camera.SetViewPortZFar( Camera camera, number zfar ) Arguments camera - The camera to update.znear - The far clip plane of the camera in units of metres. Return Values None. Description Sets the camera's far clip plane. Units are specified in metres. The default far clip plane for a newly created camera is 4000.0. Examples ! Camera.SetViewPortZFar( gameCamera, 5000.0 ) See Also • Camera.GetViewPortZFar Camera.SetViewPortZNear Brief Sets the camera's near clip plane. Definition ! Camera.SetViewPortZNear( Camera camera, number znear ) Arguments camera - The camera to update.znear - The near clip plane of the camera in units of meters. Return Values None. Description Sets the camera's near clip plane. Units are specified in metres. The default near clip plane for a newly created camera is 0.1. The minimum value that the function will accept is 0.001. Examples ! Camera.SetViewPortZNear( gameCamera, 0.2 ) See Also • Camera.GetViewPortZNear