Is it possible to control the view of an object?


(Jk76) #1

Hi there,

a consumer of us don't want to a 360° view of their products and just an 180° from above. No one want to see the underside of the product. Is it possible to take control of the camera?

He also does not want that there's the possibility to zoom.

Thx, Jens


(Shaderbytes) #2

limiting camera control is on the roadmap , not sure of the eta for it.


(Madalin Berechet) #3

use cameraPolling.html to get camera + target (x,y,z) positions every 1000 miliseconds.

I am using a function like this to avoid zooming:

`pollCamera = function() {

setInterval( function() {
    api.getCameraLookAt( function( err, camera ) {
        //console.log( "[ " + camera.position[ 0 ].toFixed(4) + ", " + camera.position[ 1 ].toFixed(4) + ", " + camera.position[ 2 ].toFixed(4) + " ]" );
        //console.log( "[ " + camera.target[ 0 ].toFixed(4) + ", " + camera.target[ 1 ].toFixed(4) + ", " + camera.target[ 2 ].toFixed(4) + " ]" );
        var z1 = camera.position[ 0 ].toFixed(4);
        var z2 = camera.position[ 1 ].toFixed(4);
        var z3 = camera.position[ 2 ].toFixed(4);
       //var z = z1 + z2 + z3;
        var z = Math.abs(z1) + Math.abs(z2) + Math.abs(z3);
        console.log("z: ", z);
        if (z < 40) {
            api.lookat(
                [currentPos[0], currentPos[1], 0], [currentTarg[0], currentTarg[1], 0],
                0
            );
        }
    });
}, 500 );

}; `

Watch out! depend on object size. The function was written for a 2 cm object.
Also set intialization option : scrollwheel: 0,
Use formulas to get a specific restriction: http://www.mathopenref.com/coordbasiccircle.html

Another possibility: Fit all your 3d scene inside a showcase of the same color as the background.