Globals
Values and functions available at the top level of every camera behavior script.
Globals
| Name | Type | Description |
|---|---|---|
postProcessSettings |
PostProcessSettings |
Postprocess settings for this camera. Mutating these fields takes effect immediately |
alwaysTick |
boolean |
If true, this camera's tick() runs every frame, even when the camera is neither active nor being followed. Default false. |
gravity |
GravityComponent |
Used to get the current gravity vector in the game. |
camera |
SpectatorCamera |
This class represents this script's camera in game. The camera object for this script. |
spectatorDebug |
SpectatorDebug |
Debug switches for spectator/replay visuals. |
config |
any |
The config table from the configuation .json file |
Functions
| Function | Description |
|---|---|
debug |
Log a message to the console using the debug log level. |
log |
Log a message to the console using the default log level. Prefer print() instead. |
print |
Log a message to the console using the default log level. |
warn |
Log a message to the console using the warning log level. |
issue |
Log a message to the console using the error log level. Unlike error() This won't raise an error. |
saveConfig |
Saves the currently active camera's config to a file. Returns true if successful. |
getCameraById |
Returns the camera object registered under the given identifier (e.g. "anotheraxiom.freecam"). |
sendMessage |
Sends an arbitrary message to another camera script. The receiving camera handles it via its onMessageReceived(message) function. |
getGameData |
Returns a ReplayFrame object representing the current game state |
getAllGameData |
Returns a list of ReplayFrames containing the current game state and the current game state of any active replays |
debug
Log a message to the console using the debug log level.
Parameters
| Name | Type |
|---|---|
message |
any |
log
Log a message to the console using the default log level. Prefer print() instead.
Parameters
| Name | Type |
|---|---|
message |
any |
Log a message to the console using the default log level.
Parameters
| Name | Type |
|---|---|
message |
any |
warn
Log a message to the console using the warning log level.
Parameters
| Name | Type |
|---|---|
message |
any |
issue
Log a message to the console using the error log level. Unlike error() This won't raise an error.
Parameters
| Name | Type |
|---|---|
message |
any |
saveConfig
Saves the currently active camera's config to a file. Returns true if successful.
Returns: boolean
getCameraById
Returns the camera object registered under the given identifier (e.g. "anotheraxiom.freecam").
Parameters
| Name | Type |
|---|---|
id |
string |
Returns: SpectatorCamera
sendMessage
Sends an arbitrary message to another camera script. The receiving camera handles it via its onMessageReceived(message) function.
Parameters
| Name | Type |
|---|---|
camera |
SpectatorCamera |
message |
any |
getGameData
Returns a ReplayFrame object representing the current game state
Returns: ReplayFrame
getAllGameData
Returns a list of ReplayFrames containing the current game state and the current game state of any active replays
Returns: {ReplayFrame}
GravityComponent
Class
A2Gravity Component
Properties
| Property | Type | Description |
|---|---|---|
gravity |
Vec3 |
Gravity acceleration vector in world space, in cm/s^2. Points in the local "down" direction. Zero in zero-g zones; check strength ~= 0 before using as a direction. Magnitude equals strength. |
strength |
number |
Magnitude of gravity in cm/s^2. 0 in zero-g zones; positive in artificial-gravity zones. Guard with if gravity.strength ~= 0 before using upDirection / upRotation to orient the camera. |
upDirection |
Vec3 |
Unit-length vector pointing in the local "up" direction (opposite of gravity). Use this as the up axis so camera roll matches the local gravity. Falls back to a default in zero-g zones. |
upRotation |
Quat |
Rotation that maps the global up vector (0, 0, 1) onto upDirection. Multiply known directions by this quaternion to rotate them into the current gravity frame. |
PostProcessSettings
Class
Post Process Settings Proxy
Properties
| Property | Type | Description |
|---|---|---|
bloomIntensity |
number |
Multiplier for all bloom contributions >=0: off, 1(default), >1 brighter |
bloomThreshold |
number |
Minimum brightness the bloom starts having effect. -1:all pixels affect bloom equally (physically correct, faster as a threshold pass is omitted), 0:all pixels affect bloom brights more, 1(default), >1 brighter |
depthOfFieldFstop |
number |
Defines the opening of the camera lens, Aperture is 1/fstop, typical lenses go down to f/1.2 (large opening), larger numbers reduce the DOF effect |
depthOfFieldFocalDistance |
number |
Distance in which the Depth of Field effect should be sharp, in unreal units (cm) |
depthOfFieldSensorWidth |
number |
Width of the camera sensor to assume, in mm |
chromaticAberrationIntensity |
number |
In percent, chromatic aberration / color fringe (camera imperfection) to simulate an artifact that happens in real-world lens, mostly visible in the image corners |
motionBlurAmount |
number |
Strength of motion blur, 0:off |
vignetteIntensity |
number |
0-1, 0=off/no vignette, 1=strong vignette |
autoExposureBias |
number |
Logarithmic adjustment for the exposure. 0: no adjustment, -1:2x darker, -2:4x darker, 1:2x brighter, 2:4x brighter, ... |
Methods
| Method | Description |
|---|---|
save |
Save the current post processing settings so they persist across sessions |
reset |
Reset post processing to its initial state. Does not save |
load |
Reapply the saved post processing settings |
save
Save the current post processing settings so they persist across sessions
Returns: nil
reset
Reset post processing to its initial state. Does not save
Returns: nil
load
Reapply the saved post processing settings
Returns: nil
SpectatorCamera
Class
Spectator Camera
Properties
| Property | Type | Description |
|---|---|---|
position |
Vec3 |
The current position of the camera (before smoothing). Setting this will change the position of this camera in game. |
rotation |
Quat |
The current rotation of the camera (before smoothing). Setting this will change the rotation of this camera in game. |
fieldOfView |
number |
The current vertical field of view of the camera in degrees (before smoothing). Setting this will change the field of view of this camera in game. |
positionSmoothing |
number |
How much smoothing is applied to the position. This number is the time it takes for the position to reach 50% of the target value. |
rotationSmoothing |
number |
How much smoothing is applied to the rotation. This number is the time it takes for the rotation to reach 50% of the target value. |
fieldOfViewSmoothing |
number |
How much smoothing is applied to the field of view. This number is the time it takes for the field of view to reach 50% of the target value. |
rotationDeadzone |
number |
The angular distance offset (radians) for rotation to occur |
isActive |
boolean |
Whether this camera is set as the active camera. There can only be one active camera at a time. |
isFollowed |
boolean |
This is true when another camera script is following this camera. Usually you want to enable your camera script inputs when this is true. |
isTransitioning |
boolean |
|
followedCamera |
SpectatorCamera? |
|
nearClippingPlane |
number |
The near clip plane of the camera. This is the closest distance that the camera will render objects. |
showNameTags |
boolean |
If name tags are visible in game. Defaults to true |
hideNearestHead |
boolean |
If the closest head to the camera should be visible |
Methods
| Method | Description |
|---|---|
showQuestsForPlayerByName |
Shows or hides quest items and progress for the player(s) with the given player name. |
showQuestsForPlayerById |
Shows or hides quest items and progress for the player with the given ID. |
setEmote |
Shows the requested emote by index on the spectator model. 0 clears the emote. |
lookAtBasic |
Rotates the camera so the forward vector points at the target position. Uses the global up vector as the up vector. |
lookAt |
Rotates the camera so the forward vector points at the target position. |
getSmoothedRotation |
Gets the actual rotation of the camera after smoothing is applied. |
getSmoothedPosition |
Gets the actual position of the camera after smoothing is applied. |
getEmote |
Returns the index of the emote currently shown on the spectator model. 0 means no emote. The emote is shared by all camera scripts. |
getSmoothedFieldOfView |
Gets the actual field of view of the camera after smoothing is applied. |
getClosestGamemodeSlot |
TODO deprecated. Use the SpectatorGamemodes class instead |
followCamera |
Once set, the camera will follow the target camera. If nil, the camera will stop following. |
castRayFromMouse |
Cast Ray from Mouse |
castRay |
Performs a raycast starting at the start position and ending at the end position. Returns a RayHit object. |
showQuestsForPlayerByName
Shows or hides quest items and progress for the player(s) with the given player name.
Parameters
| Name | Type |
|---|---|
PlayerName |
string |
bShowQuests |
boolean |
Returns: boolean
showQuestsForPlayerById
Shows or hides quest items and progress for the player with the given ID.
Parameters
| Name | Type |
|---|---|
PlayerId |
number |
bShowQuests |
boolean |
Returns: boolean
setEmote
Shows the requested emote by index on the spectator model. 0 clears the emote.
Parameters
| Name | Type |
|---|---|
Index |
number |
Returns: nil
lookAtBasic
Rotates the camera so the forward vector points at the target position. Uses the global up vector as the up vector.
Parameters
| Name | Type |
|---|---|
Target |
Vec3 |
Returns: nil
lookAt
Rotates the camera so the forward vector points at the target position.
Parameters
| Name | Type |
|---|---|
Target |
Vec3 |
UpVector |
Vec3 |
Returns: nil
getSmoothedRotation
Gets the actual rotation of the camera after smoothing is applied.
Returns: Quat
getSmoothedPosition
Gets the actual position of the camera after smoothing is applied.
Returns: Vec3
getEmote
Returns the index of the emote currently shown on the spectator model. 0 means no emote. The emote is shared by all camera scripts.
Returns: number
getSmoothedFieldOfView
Gets the actual field of view of the camera after smoothing is applied.
Returns: number
getClosestGamemodeSlot
TODO deprecated. Use the SpectatorGamemodes class instead
Returns: ModuleStateSpectatorLuaApi?
followCamera
Once set, the camera will follow the target camera. If nil, the camera will stop following.
Parameters
| Name | Type |
|---|---|
camera |
SpectatorCamera? |
Returns: nil
castRayFromMouse
Cast Ray from Mouse
Returns: RayHit
castRay
Performs a raycast starting at the start position and ending at the end position. Returns a RayHit object.
Parameters
| Name | Type |
|---|---|
Start |
Vec3 |
_end |
Vec3 |
Returns: RayHit
SpectatorDebug
Class
Spectator Debug
Properties
| Property | Type | Description |
|---|---|---|
goalExplosions |
boolean |
Manually trigger goal explosion effects |
scrapRunSpinners |
boolean |
If the scraprun spinners should spin |
placeBallHereVisuals |
boolean |
Enable or disable the ball place visual in the center of arenas |
replayBallScaleMultiplier |
number |
Multiplier for scale of all balls in the replay |
Transition
Class
A Camera Transition
Properties
| Property | Type | Description |
|---|---|---|
length |
number |
The length in seconds this transition will take to go from start to finish |
easeIn |
number |
|
easeOut |
number |
|
startTime |
number |
|
startPosition |
Vec3 |
|
startRotation |
Quat |
|
startFieldOfView |
number |
|
mode |
string |
|
previousCamera |
SpectatorCamera? |