Product Camera Controls
Control the camera to create optimal product viewing experiences. These camera functions are designed for product photography, e-commerce displays, and interactive product demonstrations where precise camera control is essential.
getCameraTarget
getCameraTarget(callback: Function)
Get the camera target.
api.getCameraTarget(function(target){
console.log(target); // Result: [x, y, z]
});
2
3
setCameraTarget
setCameraTarget(target: [x: number, y: number, z: number], [duration: number], [callback: Function])
Sets the camera target position. The duration is the time for the transition from the current target to the new target (a number in seconds; defaults to 2).
api.setCameraTarget([0, 0, 0], 2.5, function(camera){
console.log('Camera target changed');
});
2
3
getCameraPosition
getCameraPosition(callback: Function)
Gets the camera position.
api.getCameraPosition(function(position){
console.log(position); // Result: [x, y, z]
});
2
3
setCameraPosition
setCameraPosition(position: [x: number, y: number, z: number], [duration: number], [callback: Function])
Sets the camera position. The duration is the time for the transition from the current position to the new position (a number in seconds; defaults to 2).
api.setCameraPosition([5, 5, 5], 2.5, function(camera){
console.log('Camera position changed');
});
2
3
getCameraLookAt
getCameraLookAt(callback: Function)
Returns the current camera position and target.
api.getCameraLookAt(function(camera){
console.log(camera.position); // Result: [x, y, z]
console.log(camera.target); // Result: [x, y, z]
});
2
3
4
setCameraLookAt
setCameraLookAt(position: [x: number, y: number, z: number], target: [x: number, y: number, z: number], [duration: number], [callback: Function])
Sets the camera position and target. The duration is the time for the transition from the current camera to the new camera (a number in seconds; defaults to 2).
api.setCameraLookAt([0, 10, 0], [0, 0 ,0], 2.5, function(camera){
console.log('Camera moved');
});
2
3
startRotateCamera
startRotateCamera(direction: 1 | -1, [callback: Function])
Start the rotation of the camera around the target on the objects x-axis. Set the direction +1 (clockwise) or -1 (counterclockwise).
api.startRotateCamera(1, function(){
console.log('Camera rotation started');
});
2
3
stopRotateCamera
stopRotateCamera([callback: Function])
Stop the rotation of the camera.
api.stopRotateCamera(function(){
console.log('Camera rotation stopped');
});
2
3
recenterCamera
recenterCamera([callback: Function])
Centers the camera around the objects bounding box, taking portrait/landscape mode into account.
api.recenterCamera(function(){
console.log('Camera recentered');
});
2
3
focusOnVisibleGeometries
focusOnVisibleGeometries([callback: Function])
Centers the camera around the objects visible geometries, taking portrait/landscape mode into account.
api.focusOnVisibleGeometries(function(){
console.log('Camera Recentered');
});
2
3
setFov
setFov(angle: number, [callback: Function])
Defines the camera field of view (FoV). The angle is a number, in degrees, between 1 and 179.
api.setFov(80, function(){
console.log('Camera Fov changed');
});
2
3
getFov
getFov(callback: Function)
Returns the cameras current field of view (FoV) in degrees.
api.getFov(function(fov){
console.log('Camera Fov is', fov); // Result: 80
});
2
3
Best Practices
- Performance: Use
getCameraLookAt()
before complex movements to avoid jarring transitions - UX: Limit camera transitions to 2-3 seconds for optimal user experience
- Mobile: Test field of view settings on mobile devices for proper product visibility
Related Topics
📚 📚 Essential Reading
- Getting Started with Product ViewerBasic viewer integration
- Viewer API OverviewComplete API reference
- Events APIMonitor camera changes and user interactions
🎯 🎯 Use Cases & Tutorials
- Interactive Product PhotographyCreate professional product shots
- E-commerce Integration GuideBest practices for online stores
🔧 🔧 Related APIs
- Animations APICombine camera movements with animations
- Objects APIFocus camera on specific product parts
- General APIViewer initialization and configuration