Libraries.Game.Graphics.PerspectiveCamera Documentation

Inherits from: Libraries.Language.Object, Libraries.Game.Graphics.Camera

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

Example

use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)

GetCombinedMatrix()

This action returns a matrix containing the combined values of the camera's projection and view matrices. This is primarily used internally by the engine for calculations.

Return

Libraries.Compute.Matrix4: The combined projection and view Matrix of the Camera.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Camera
use Libraries.Compute.Matrix4

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame

        Camera cam = GetCamera3D()
        Matrix4 combined = cam:GetCombinedMatrix()
    end

    action Update(number seconds)
    end

end

GetDirection()

This action will return the current direction of the Camera. The direction is returned as a Vector3 object. This is a reference to the actual Vector3 used by the Camera, so changes to the vector will effect the Camera.

Return

Libraries.Compute.Vector3: The Vector3 used by this Camera to store its direction.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Camera
use Libraries.Compute.Vector3

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame

        Camera cam = GetCamera3D()
        Vector3 direction = cam:GetDirection()

        output "The default 3D camera direction is " + direction:GetX()
             + ", " + direction:GetY() + ", " + direction:GetZ()
    end

    action Update(number seconds)
    end

end

GetFar()

This action will return the distance to the far clipping plane of the camera. Objects that are farther than the distance to the far clipping plane will not be seen by the camera.

Return

number: The distance to the far clipping plane of the Camera.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Camera
use Libraries.Compute.Vector3

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Camera cam = GetCamera3D()
        
        output "The default distance to the far clipping plane of the 3D camera is " + cam:GetFar()
    end

    action Update(number seconds)
    end

end

GetFieldOfView()

This action will return the field of view of the camera to the given angle. The field of view is measured in degrees.

Return

number:

GetFrustum()

This action returns a frustum containing the area visible to the camera.

Return

Libraries.Compute.Frustum: The frustum that contains the Camera's visible area.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Camera
use Libraries.Compute.Frustum

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame

        Camera cam = GetCamera3D()
        Frustum frustum = cam:GetFrustum()
    end

    action Update(number seconds)
    end

end

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetHeight()

This action will return the effective height of the camera lens.

Return

number: The height of the Camera lens.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Camera
use Libraries.Compute.Vector3

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame

        Camera cam = GetCamera3D()
        
        output "The default height of the 3D camera is " + cam:GetHeight()
    end

    action Update(number seconds)
    end

end

GetInverseCombinedMatrix()

This action returns a matrix containing the inversed combined projection and view matrices. This is primarily used internally by the engine for calculations.

Return

Libraries.Compute.Matrix4: The inverse of the combined projection and view Matrices of the Camera.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Camera
use Libraries.Compute.Matrix4

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame

        Camera cam = GetCamera3D()
        Matrix4 inverse = cam:GetInverseCombinedMatrix()
    end

    action Update(number seconds)
    end

end

GetNear()

This action will return the distance to the near clipping plane of the camera. Objects that are closer than the distance to the near clipping plane will not be seen by the camera.

Return

number: The distance to the near clipping plane of the Camera.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Camera
use Libraries.Compute.Vector3

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Camera cam = GetCamera3D()
        
        output "The default distance to the near clipping plane of the 3D camera is " + cam:GetNear()
    end

    action Update(number seconds)
    end

end

GetPickRay(number screenX, number screenY)

GetPickRay will return a ray that begins at the given screen coordinates and points in the direction that the camera is viewing. The Ray's position will be in world coordinates.

Parameters

  • number screenX
  • number screenY

Return

Libraries.Compute.Ray:

GetPickRay(number screenX, number screenY, number viewportX, number viewportY, number viewportWidth, number viewportHeight)

GetPickRay will return a ray that begins at the given screen coordinates and points in the direction that the camera is viewing. The Ray's position will be in world coordinates. This action will calculate the point using the given position and dimensions of the viewport.

Parameters

  • number screenX
  • number screenY
  • number viewportX
  • number viewportY
  • number viewportWidth
  • number viewportHeight

Return

Libraries.Compute.Ray:

GetPosition()

This action will return the current position of the Camera. The position is returned as a Vector3 object containing the current x, y, and z coordinates. This is a reference to the actual Vector3 used by the Camera, so changes to the vector will effect the Camera.

Return

Libraries.Compute.Vector3: The Vector3 used by the Camera to store its position.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Camera
use Libraries.Compute.Vector3

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame

        Camera cam = GetCamera3D()
        Vector3 position = cam:GetPosition()

        output "The default 3D camera position is " + position:GetX()
             + ", " + position:GetY() + ", " + position:GetZ()
    end

    action Update(number seconds)
    end

end

GetProjectionMatrix()

This action returns the calculated projection matrix of the Camera. This is primarily used internally by the engine for calculations.

Return

Libraries.Compute.Matrix4: The projection Matrix of the Camera.

Example