-
-
Notifications
You must be signed in to change notification settings - Fork 50
Camera and Viewport
Marc Flerackers edited this page Jun 9, 2024
·
5 revisions
The camera component marks the mode as a potential camera for a viewport.
add([
camera("camera-name")
])
This will use the node's global transform as the camera transform.
A viewport renders what a camera sees. The center of the camera is rendered in the center of the viewport. Cameras can be switched by simply assigning a new one to the viewport.
const vp = add([
viewport("camera-name", width, height)
])
vp.camera = "second camera"
When no viewport is defined,the viewport defaults to the kaplay screen. When a viewport is defined, no default viewport is rendered. When null is assigned as camera (the default), The default camera is used.