Represents a game camera.
Constructors and accessors
Related sample code
Other related reference items
Related help topics
far_range ( self ) : numberReturns the far range value of the camera.
|
self : | 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. |
number |
The far range value. |
get_data ( self, indices ) : anyRetrieves the data set at the specified indices within the camera's script data object.
|
self : | 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. |
any |
The data previously stored at the specified sequence of indices. |
Similar to Unit.get_data().
Other related reference items
has_data ( self, indices ) : booleanIndicates whether or not any data has been saved at the specified indices in the camera's script data object.
|
self : | 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. |
boolean |
Returns true if a data value is stored at the specified sequence of indices, or false otherwise. |
Similar to Unit.has_data().
inside_frustum ( self, w ) : numberIndicates whether the Vector3 w is inside the camera's frustum.
|
self : | 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 : | A point that is tested. |
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. |
mode ( self ) : integerReturns the camera mode.
|
self : | 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. |
integer |
One of the defined mode type values. |
near_range ( self ) : numberReturns the near range value of the camera.
|
self : | 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. |
number |
The near range value. |
projection ( self, aspect_ratio ) : stingray.Matrix4x4Computes a projection matrix for the camera given an aspect ratio
|
self : | 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 |
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]
projection_type ( self ) : integerReturns the projection type of the camera.
|
self : | 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. |
integer |
One of the defined projection type values. |
screen_to_world ( self, p, d, window, viewport_size ) : stingray.Vector3Converts a point p from screen coordinates to world coordinates.
|
self : | 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 : | A point in screen coordinates (x, y, 0) | |
d : | number | Depth of point |
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 : | 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. |
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.
Related sample code
set_data ( self, indices, indices, indices, value ) set_data ( self, indices, indices, value ) set_data ( self, indices, value )Stores the specified value in the camera's script data object, at a location determined by the specified indices.
|
self : | 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. |
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().
set_far_range ( self, range )Sets the far range value of the camera.
|
self : | 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. |
This function does not return any values. |
set_frustum ( self, left, right, down, up, index )Sets the frustum dimensions for the perspective view.
|
self : | 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. |
This function does not return any values. |
set_frustum_half_angles ( self, left_tan, right_tan, down_tan, up_tan, index )Sets the frustum dimensions for the perspective view using half angles (in radians).
|
self : | 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. |
This function does not return any values. |
set_local ( self, m, index )Offsets camera world pose.
|
self : | 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 : | 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. |
This function does not return any values. |
i.e. Used during stereo rendering in order to compute left and right eye poses.
set_mode ( self, mode )Sets the camera mode.
|
self : | 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. |
This function does not return any values. |
set_near_range ( self, range )Sets the near range value of the camera.
|
self : | 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. |
This function does not return any values. |
set_orthographic_view ( self, min_x, max_x, min_z, max_z, index )Sets the minimum and maximum coordinates for the orthographic view.
|
self : | 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. |
This function does not return any values. |
set_projection_type ( self, projection_type )Sets the projection type of the camera.
|
self : | 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. |
This function does not return any values. |
set_vertical_fov ( self, fov, index )Sets the vertical Field of View angle of the camera.
|
self : | 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. |
This function does not return any values. |
vertical_fov ( self, index ) : numberReturns the vertical Field of View angle set for the camera.
|
self : | 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. |
number |
The Field of View angle. |
world_to_screen ( self, w, window, viewport_size ) : stingray.Vector3, numberConverts a point w from world coordinates to screen coordinates.
|
self : | 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 : | A point in world coordinates. | |
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 : | 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. |
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.
The functions in this group control the placement of an object of this type in the scene.
local_pose ( self ) : stingray.Matrix4x4Returns the position and orientation of the specified scene graph object in local space: i.e. relative to its parent in the scene graph.
|
self : | 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. |
The position and orientation of the object in local space. |
local_position ( self ) : stingray.Vector3Returns the position of the specified scene graph object in local space: i.e. relative to its parent in the scene graph.
|
self : | 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. |
The position of the object in local space. |
local_rotation ( self ) : stingray.QuaternionReturns the orientation of the specified scene graph object in local space: i.e. relative to its parent in the scene graph.
|
self : | 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. |
The rotation of the object in local space. |
node ( self ) : integerReturns the ID of the specified object within the scene graph.
|
self : | 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. |
integer |
The ID of the specified object in the scene graph. |
set_local_pose ( self, parent, pose )Sets the position and orientation of the specified scene graph object in local space: i.e. relative to its parent in the scene graph.
|
self : | 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 : | The parent Unit that owns this object. | |
pose : | The new position and orientation for the object in local space. |
This function does not return any values. |
Related sample code
set_local_position ( self, parent, position )Sets the position of the specified scene graph object in local space: i.e. relative to its parent in the scene graph.
|
self : | 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 : | The parent Unit that owns this object. | |
position : | The new position for the object in local space. |
This function does not return any values. |
Related sample code
set_local_rotation ( self, parent, rotation )Sets the orientation of the specified scene graph object in local space: i.e. relative to its parent in the scene graph.
|
self : | 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 : | The parent Unit that owns this object. | |
rotation : | The new rotation for the object in local space. |
This function does not return any values. |
Related sample code
world_pose ( self ) : stingray.Matrix4x4Returns the position and orientation of the specified scene graph object in world space.
|
self : | 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. |
The position and orientation of the object in world space. |
world_position ( self ) : stingray.Vector3Returns the position of the specified scene graph object in world space.
|
self : | 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. |
The position of the object in world space. |
Related sample code
world_rotation ( self ) : stingray.QuaternionReturns the rotation of the specified scene graph object in world space.
|
self : | 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. |
The rotation of the object in world space. |
Defines the different modes a camera can use.
You can set up a camera to a specific mode by calling set_mode().
MONO : integerSpecifies a monoscopic camera.
|
STEREO : integerSpecifies a stereoscopic camera.
|
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 : integerSpecifies an orthographic camera.
|
PERSPECTIVE : integerSpecifies a perspective camera.
|