Camera Management: Settings and Switching
How to use VIVERSE SDK's CameraService to manage camera settings and switch between different VIVERSE and custom cameras.
Basic Camera Switching
import { Script } from "playcanvas";
import { CameraService, CameraTypes } from "../@viverse/create-sdk.mjs";
export class CameraManager extends Script {
initialize() {
this.cameraService = new CameraService();
// Switch to first person view to first person
this.cameraService.switchPov(CameraTypes.PovTypes.FirstPerson);
// At any time, you can switch back to CameraTypes.PovTypes.ThirdPerson
// Prevent users from switching POV, which is usually done in user settings or with the keyboard shortcut "V"
this.cameraService.canSwitchPov = false;
}
}Custom Camera Override Example
Camera Switching on Events: VR and Player Ready
Additional Camera Properties
Additional Resources
Last updated
Was this helpful?