本文介绍了相机外观无法使用立体效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用以下代码使用立体效果时,我应该如何让我的相机观察某个 Vector3?

When I use stereoeffect using the following code, how should I get my camera to lookAt a certain Vector3?

function animate() {
    var elapsedSeconds = clock.getElapsedTime();
    requestAnimationFrame(animate);

    update(clock.getDelta());
    render(clock.getDelta());
  }

  function update(dt) {
    resize();
    camera.updateProjectionMatrix();
    controls.update(dt);
  }

  function render(dt) {
    effect.render(scene, camera);
  }

我在初始化代码中添加了 camera.lookAt,但我知道 render(..) 函数会不断调用并覆盖我的 lookAt.

I added camera.lookAt in my initialization code but I understand the render(..) function is constantly called and overrides my lookAt.

那么,如何正确初始化场景以便设置我的lookAt点?

So, how do I correctly initialize the scene so that my lookAt point is set?

推荐答案

我认为控件更新更有可能将相机发送回它自己的目标.尝试改为设置控件目标.

I think its more likely the controls update sending the camera back to it's own target. Try setting the controls target instead.

    var lookat = vertex; /// whatever Vector3 you are using already

    controls.target = lookat;
    controls.update();

这篇关于相机外观无法使用立体效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 09:04