Camera
Look up camera calls and properties.
camera.get_horizontal_basis()
Read camera-relative forward and right directions.
- Arguments
No arguments.
- Returns
[forward, right], each a three-number vector.
- Works with
The active gameplay camera.
- Missing values and errors
This supplies directions, not movement.
debug.log(camera.get_horizontal_basis())camera.set_position(x, y, z) or camera.set_position([x, y, z])
Place the gameplay camera.
- Arguments
Three numbers, or one basket of three numbers.
- Returns
nil.
- Works with
The active gameplay camera.
- Missing values and errors
Wrong counts, types, or basket lengths report an error.
camera.set_position([0, 2, 5])camera.set_target(x, y, z) or camera.set_target([x, y, z])
Choose the gameplay camera target.
- Arguments
Three numbers, or one basket of three numbers.
- Returns
nil.
- Works with
The active gameplay camera.
- Missing values and errors
Wrong counts, types, or basket lengths report an error.
camera.set_target([0, 2, 5])camera.set_orientation(yaw, pitch)
Set gameplay camera orientation.
- Arguments
Two numeric angles used by the gameplay camera.
- Returns
nil.
- Works with
The active gameplay camera.
- Missing values and errors
Wrong argument counts or types report an error.
camera.set_orientation(0, 0)camera.get_script()
Read the active camera script package.
- Arguments
No arguments.
- Returns
The active camera package name as a string.
- Works with
The camera used in Play mode.
- Missing values and errors
The value describes the selected camera package, not a Player controller.
const previous = camera.get_script()
debug.log(previous)camera.set_script(package_name)
Select a camera script package for the current Play session.
- Arguments
package_name: string naming an installed camera package.- Returns
nil.- Works with
Installed camera script packages.
- Missing values and errors
An invalid or unavailable package reports an error; the previous working camera is retained.
The camera package changes on the next camera update. The selection is not saved to Project Settings.
const previous = camera.get_script()
camera.set_script("firstPerson")
// Restore the previous camera later.
camera.set_script(previous)camera.spring_arm(settings) [BETA]
Calculate a smoothed, collision-aware gameplay camera.
- Arguments
One options map with target and supported camera settings.
- Returns
Map with position, target, and obstructed.
- Works with
The current Play camera.
- Missing values and errors
Invalid settings raise an error.
const view = camera.spring_arm(settings)