Make OrbitControls turn camera exact 180 degress from its current position/rotation

Can I tell OrbitControls to rotate the camera (rotationY) exactly 180° from its current rotation.y?

Any help is highly appreciated
b

you can’t. this has been a request for many years. though you may want to exchange three/examples/jsm with this: https://github.com/pmndrs/three-stdlib

the difference is that stdlib is a little more liberal when it comes to accepting prs.

controls.setAzimuthalAngle(azimuth)
controls.setPolarAngle(polar)

Just for my understanding: do you want to have the camera look away from the target?

If that’s the case, you might(!!) possibly achieve the same effect (that is: HACK OrbitControls without any code change) by providing a “fake” target which would have to be re-computed on every new frame though.

Food for thought.

Please report back.

Thanks for all your feedback - meanwhile I solved it that way that I expanded origin OrbitControls with a little extra-function that I can fire from my main-class then…

function setTheta( radians ) {
sphericalDelta.theta -= radians;
}

One way is a dirty hack hard-coding:

this.rotate = function( x = 1, q ) { 
x = Math.PI*x/180; 
if( q ) rotateLeft(x); 
else rotateUp(x); 
this.update(); 
};

Exposing private methods or you can simply do this:

camera.position.applyQuaternion(
(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3( 0, 1, 0 ), Math.PI)); 
controls.update();