-
Notifications
You must be signed in to change notification settings - Fork 0
CAMERA
Lili edited this page Jul 5, 2026
·
5 revisions
Class Camera() :
-
Transform
Camera.transform: Transform attached to the Camera (the default Camera Transform's name is "Main Camera") - Float
Camera.zoom: zoom, must be a strictly positive float (default value = 1)
The built-in Camera is accessible via MainCamera.
Example of use :
class CameraController extends Behavior {
constructor(_transform) {
super(_transform);
// init-called data here...
this.target = FindTransformByName("spider"); // set Camera's object to follow
}
Start() {
// this instance is called when the Transform object is created...
MainCamera.zoom = 0.5; // the view will be 2 times closer than default
}
Update() {
// this instance is called once per frame...
// follow target position :
MainCamera.transform.x = target.x;
MainCamera.transform.y = target.y;
}
}