Camera - stingray.Camera object reference - Stingray Lua API Reference

Description

Represents a game camera.

Functions

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

number

The far range value.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

indices :

any(integer, string)+

One or more indices for the data, which may be integers or strings.

The + notation indicates that there may be one or more instances of the specified type.
The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.
Returns

any

The data previously stored at the specified sequence of indices.

Similar to Unit.get_data().

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

indices :

any(integer, string)+

One or more indices for the data, which may be integers or strings.

The + notation indicates that there may be one or more instances of the specified type.
The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.
Returns

boolean

Returns true if a data value is stored at the specified sequence of indices, or false otherwise.

Similar to Unit.has_data().

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

w :

stingray.Vector3

A point that is tested.

Returns

number

A positive value indicates that the point is inside the frustum, and specifies how many meters inside the frustum the point is. A negative value indicates that the point is outside the frustum, and specifies how far outside the frustum the point is.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

integer

One of the defined mode type values.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

number

The near range value.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

aspect_ratio :

number

The target aspect ratio

Returns

stingray.Matrix4x4

The compound projection matrix

Based on the Camera's mode, will generate a valid projection matrix. The aspect ratio is a number in the interval ]0.0, 1.0]

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

integer

One of the defined projection type values.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

p :

stingray.Vector3

A point in screen coordinates (x, y, 0)

d :

number

Depth of point

window :

stingray.Window?

The window to test. Optional; if not specified, uses the largest application window.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

viewport_size :

stingray.Vector2?

Size of viewport. Optional; if not specified uses window back buffer size

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

stingray.Vector3

The converted point in world coordinates.

In screen coordinates, the (X,Y) values are the pixel positions of the point on the screen and the Z value is unused. The depth value indicates the depth into the screen where the point lies (the distance from the camera plane), in meters.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

indices :

any(integer, string)

One or more indices for the data, which may be integers or strings.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.

value :

any

The value to store.

Returns
This function does not return any values.

You can retrieve the data later by passing the same indices in a call to get_data(). Similar to Unit.set_data().

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

range :

number

The far range value set.

Returns
This function does not return any values.
Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

left :

number

The left value of the view volume.

right :

number

The right value of the view volume.

down :

number

The bottom value of the view volume.

up :

number

The top value of the view volume.

index :

number?

Optional? Sub camera index. If not specified defaults to 1.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.
Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

left_tan :

number

The left value of the view volume.

right_tan :

number

The right value of the view volume.

down_tan :

number

The bottom value of the view volume.

up_tan :

number

The top value of the view volume.

index :

number?

Optional? Sub camera index. If not specified defaults to 1.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.
Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

m :

stingray.Matrix4x4

Local transform to apply to camera world.

index :

number?

Optional? Sub camera index. If not specified defaults to 1.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.

i.e. Used during stereo rendering in order to compute left and right eye poses.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

mode :

integer

The camera mode. Can be one of the defined mode type values.

Returns
This function does not return any values.
Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

range :

number

The near range value set.

Returns
This function does not return any values.
Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

min_x :

number

The minimum x value of the view volume.

max_x :

number

The maximum x value of the view volume.

min_z :

number

The minimum z value of the view volume.

max_z :

number

The maximum z value of the view volume.

index :

number?

Optional? Sub camera index. If not specified defaults to 1.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.
Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

projection_type :

integer

The projection type. Can be one of the defined projection type values.

Returns
This function does not return any values.
Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

fov :

number

The Field of View angle.

index :

number?

Optional? Sub camera index. If not specified defaults to 1.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.
Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

index :

number?

Optional? Sub camera index. If not specified defaults to 1.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

number

The Field of View angle.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

w :

stingray.Vector3

A point in world coordinates.

window :

stingray.Window?

The window to test. Optional; if not specified, uses the largest application window.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

viewport_size :

stingray.Vector2?

Size of viewport. Optional; if not specified uses window back buffer size

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

stingray.Vector3

The converted point in screen coordinates.

number

The converted point depth value

In screen coordinates, the (X,Y) values are the pixel positions of the point on the screen and the Z value is unused. The depth value indicates the depth into the screen where the point lies (the distance from the camera plane), in meters.

Scene placement

The functions in this group control the placement of an object of this type in the scene.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

stingray.Matrix4x4

The position and orientation of the object in local space.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

stingray.Vector3

The position of the object in local space.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

stingray.Quaternion

The rotation of the object in local space.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

integer

The ID of the specified object in the scene graph.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

parent :

stingray.Unit

The parent Unit that owns this object.

pose :

stingray.Matrix4x4

The new position and orientation for the object in local space.

Returns
This function does not return any values.
Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

parent :

stingray.Unit

The parent Unit that owns this object.

position :

stingray.Vector3

The new position for the object in local space.

Returns
This function does not return any values.
Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

parent :

stingray.Unit

The parent Unit that owns this object.

rotation :

stingray.Quaternion

The new rotation for the object in local space.

Returns
This function does not return any values.
Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

stingray.Matrix4x4

The position and orientation of the object in world space.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

stingray.Vector3

The position of the object in world space.

Parameters

self :

stingray.Camera

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

stingray.Quaternion

The rotation of the object in world space.

Mode types

Defines the different modes a camera can use.

You can set up a camera to a specific mode by calling set_mode().

MONO : integer

Specifies a monoscopic camera.

STEREO : integer

Specifies a stereoscopic camera.

Projection types

Defines the different types of projection that a camera can use.

You can set up a camera to use one of these projection modes by calling set_projection_type().

ORTHOGRAPHIC : integer

Specifies an orthographic camera.

PERSPECTIVE : integer

Specifies a perspective camera.