Tween camera position while rotation with slerp — THREE.js

前端 未结 1 722
忘掉有多难
忘掉有多难 2021-02-08 01:39

I want to tween camera position while rotation.

Here is my function:

function moveAndLookAt(camera, d         


        
1条回答
  •  时光说笑
    2021-02-08 02:36

    In your code

    // rotation (using slerp)
    (function () {
    var qa = camera.quaternion; // src quaternion
    

    Change it to

    qa = new THREE.Quaternion().copy(camera.quaternion); // src quaternion
    

    The way you do it, qa is the same as the camera quaternion, and it feeds back in the slerp calculus. It must be a constant variable.

    0 讨论(0)
提交回复
热议问题