I have scene where I have number of models , So When I click on any of mesh I set the centre of model as target of the Orbit control ( so model rotates from that centre (pivot point))
But when I change the orbit control target camera also rotates - I want camera rotation as it is but changes selected mesh in centre and rotation should be around that model (pivot to centre of that model)
function setCenterTarget(result) {
if (result == main_model) {
return
}
const box = new THREE.Box3().setFromObject(result);
const center = new THREE.Vector3();
box.center(center);
orbit_ctrl.target = center
}
see the video when I tap on model - camera rotates - I want camera should not change rotation - just centre the model
Could you add THREE.AxesHelper, so that it is easier to see how the orientation is changed. My expectation is that the camera is close to the direction of the up vector – this is one of the possible causes of the demonstrated effect. If this is the reason, you will need to change the up vector.
When you click on various locations and the jaw makes strange rotations … does the green axis always point to the top of the window? If the answer is “yes”, then most likely it is a problem with the camera’s up vector.