我在旋转球体的渲染中遇到了一个奇怪的问题:动画似乎在晃动,我不知道这个问题来自哪里。
这是此链接上的示例
和渲染功能:
function render() {
controls.update();
requestAnimationFrame(render);
// For camera rotation : parametric parameter
timer = Date.now()*0.0001;
// Coordinates of camera
coordCamera.set(radiusCamera*Math.cos(timer), radiusCamera*Math.sin(timer), 0);
// Rotate camera function
rotateCamera();
// Rendering
renderer.render(scene, camera);
}
具有rotateCamera
和computeRotation
功能:
function computeRotation (objectRotation, coordObject) {
// Apply rotation matrix
var rotationAll = new THREE.Matrix4();
var rotationX = new THREE.Matrix4().makeRotationX(objectRotation.rotation.x);
var rotationY = new THREE.Matrix4().makeRotationY(objectRotation.rotation.y);
var rotationZ = new THREE.Matrix4().makeRotationZ(objectRotation.rotation.z);
rotationAll.multiplyMatrices(rotationX, rotationY);
rotationAll.multiply(rotationZ);
// Compute world coordinates
coordObject.applyMatrix4(rotationAll);
}
function rotateCamera() {
// Compute coordinates of camera
computeRotation(torus, coordCamera);
// Set camera position for motion
camera.position.set(coordCamera.x, coordCamera.y, coordCamera.z)
}
如果有人能看出问题所在,那就太好了,
谢谢你的帮助
更新 :
我试图在下面插入解决方案;我没有制作动画,没有显示任何内容:这是我对 jsfiddle 的尝试:
https://jsfiddle.net/ysis81/uau3nw2q/5/
我也尝试了 performance.now() 但动画仍在晃动;你可以在https://jsfiddle.net/ysis81/2Lok5agy/3/上查看这个
我已经开始悬赏来解决这个问题。