How to change camera controller of default camera (orbital, editor, etc.)

Q: In my app I call joinOrStartSession with viewport properties that specifies to use an orbit camera controller. Here is my code that does that:

await SDK3DVerse.joinOrStartSession({
    userToken: publicToken,
    sceneUUID: mainSceneUUID,
    canvas: document.getElementById("display-canvas"),
		viewportProperties: {
			id: 0,
			width: 0,
			height: 0,
			left: 0,
			top: 0,
			defaultCameraController : SDK3DVerse.cameraController.orbit
		}
});

How can I change the camera controller of my camera? to SDK3DVerse.cameraController.editor for example?

Answer:

You can use setControllerType in Viewport. To get your viewport with id 0, you can call

const viewport= SDK3DVerse.engineAPI.cameraAPI.getViewportByID(0)

Then simply do:

viewport.setControllerType(SDK3DVerse.cameraController.editor)