Feature Request: Add control to the Camera Constraint in the API Viewer


(Pierre Savoie) #1

I would like to get more control over the camera constraint with the Viewer API.

With the viewer API, I made custom camera position to highlight specific part of a model. I would like to limit the amount of movement possible when at a certain position.

Take a look at this example, I would like to get a similar result using Sketchfab
Viscircle 3D Configurator


Really nice product, super slow though, at least on my machine

(Pierre Savoie) #3

Notice how the camera constraint change dynamically based on the slide your on.
I would like a similar function in Sketchfab's Viewer API. Something that could look like that :

$("#state1").on("click", function (event) {
            api.getCameraConstraint( function( err, camera ){
				console.log( camera.zoom );
				console.log( camera.pitch );
				console.log( camera.yaw );
				// Limit Zoom
				[ 5, 11.6],
				// Limit vertical rotation
				[ 89, 0],
				// Limit horizontal rotation
				[ 315, 156],
				// Near clipping distance
			} );

No idea if that's how it would look or work, but you get the idea.


It would be a bit tedious to set up, but you could poll the camera position and target continuously and prevent it leaving your bounds at each position.

Old example here: https://forum.sketchfab.com/t/viewer-api-zoom-demo/3524