Closed scorpio921 closed 1 hour ago
Rotate the x-axis 90 degrees, and then rotate the y-axis 90 degrees at the wrong angle
// code goes here
function rollCamera(axisName, radians) { const axis = new THREE.Vector3();
if (axisName === "X") { axis.set(1, 0, 0); } else if (axisName === "Y") { axis.set(0, 1, 0); } else if (axisName === "Z") { axis.set(0, 0, 1); } if (controls instanceof ArcballControls) { const offset = new THREE.Vector3().subVectors(camera.position, controls.target); const quaternion = new THREE.Quaternion(); quaternion.setFromAxisAngle(axis.normalize(), radians); offset.applyQuaternion(quaternion); camera.up.applyQuaternion(quaternion); camera.position.copy(controls.target).add(offset); camera.lookAt(controls.target); camera.updateMatrixWorld(); console.log('之后:',camera.position); controls.update(); viewHelper.update(); }
} let dataArray = []; const animateModel = (type, direction) => { console.log(type, direction); // Enable rendering enableRender();
if (type == 'reset') { controls.reset(); dataArray = [] return; } dataArray.push(type); let angle = 90 console.log(type); const radians = type !== 'Z' && direction === 'up' || type === 'Z' && direction !== 'up' ? -(Math.PI/180)*angle : (Math.PI/180)*angle; rollCamera(type, radians);
}
No response
0.163.0
Chrome
Windows
Please use one of the links below for help / support:
Description
Rotate the x-axis 90 degrees, and then rotate the y-axis 90 degrees at the wrong angle
Reproduction steps
Rotate the x-axis 90 degrees, and then rotate the y-axis 90 degrees at the wrong angle
Code
function rollCamera(axisName, radians) { const axis = new THREE.Vector3();
} let dataArray = []; const animateModel = (type, direction) => { console.log(type, direction); // Enable rendering enableRender();
}
Live example
Screenshots
No response
Version
0.163.0
Device
No response
Browser
Chrome
OS
Windows