Camera
getCameraRotation
getCameraRotation(callback: Function)
Gets the camera rotation (in Radians).
api.getCameraRotation(function(rotation){
console.log(rotation); // Result: [x, y, z]
});
setCameraRotation
setCameraRotation(rotation: [x: number, y: number, z: number], [duration: number], [callback: Function])
Sets the camera rotation (in Radians). The duration is the time of the move from the current rotation to the new rotation (a number, in seconds; 2 by default)
api.setCameraRotation([0, Math.PI, 0], 2.5, function(camera){
console.log('Camera rotation changed');
});
getCameraPosition
getCameraPosition(callback: Function)
Gets the camera position.
api.getCameraPosition(function(position){
console.log(position); // Result: [x, y, z]
});
setCameraPosition
setCameraPosition(position: [x: number, y: number, z: number], [duration: number], [callback: Function])
Sets the camera position. The duration is the time of the move from the current position to the new position (a number, in seconds; 2 by default)
api.setCameraPosition([5, 5, 5], 2.5, function(camera){
console.log('Camera position changed');
});
getCameraOrientation
getCameraOrientation(callback: Function)
Returns the current camera position and rotation (radians).
api.getCameraOrientation(function(camera){
console.log(camera.position); // Result: [x, y, z]
console.log(camera.rotation); // Result: [x, y, z]
});
setCameraOrientation
setCameraOrientation(position: [x: number, y: number, z: number], rotation: [x: number, y: number, z: number], [duration: number], [callback: Function])
Sets the camera position and rotation (radians). The duration is the time of the move from the current camera to the new camera (a number, in seconds; 2 by default)
api.setCameraOrientation([0, 10, 0], [0, Math.PI, 0], 2.5, function(camera){
console.log('Camera moved');
});
switchCameraType
switchCameraType(type: 'walk' | 'birdseye' | 'vr' | 'cardboard' | 'anaglyph' | 'topdown' | 'virtual-joysticks' | 'device-orientation', [callback: Function])
Switch the camera type.
api.switchCameraType('birdseye', function(){
console.log('Camera type switched');
});
setCameraZoom
setCameraZoom(radius: number, [duration=0], [callback: Function])
Sets the birdseye camera radius. The duration is the time of the move from the current camera radius to the new camera radius (a number, in seconds; 0 by default)
api.setCameraZoom(30, 5, function(){
console.log('Camera radius changed');
});
getCameraZoom
getCameraZoom(callback: Function)
Gets the birdseye camera radius.
api.getCameraZoom(function (radius) {
console.log(radius); // Result: number
});