Hello Everyone
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)
camera = new THREE.OrthographicCamera();
camera.left = window.innerWidth / -40;
camera.right = window.innerWidth / 40;
camera.top = window.innerHeight / 40;
camera.bottom = window.innerHeight / -40;
camera.near = 0.1;
camera.far = 400;
orbit_ctrl = new THREE.OrbitControls(camera, renderer.domElement);
orbit_ctrl.enableDamping = true;
orbit_ctrl.dampingFactor = 0.5;
orbit_ctrl.minDistance = 200;
orbit_ctrl.maxDistance = 3400;
This is how I centre the 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