TextGeometry to always face user?

前端 未结 2 736
说谎
说谎 2020-12-31 09:23

I\'ve added some text to my scene with THREE.TextGeometry, and the text seems to be stuck in whichever xy plane I place it. Any way to have it adjust to always be in plane w

相关标签:
2条回答
  • 2020-12-31 09:51

    To make the text always face the screen (rather than the camera):

    mesh.quaternion.copy(camera.quaternion);

    Note that this differs from object.lookAt(camera); since this will result in different orientation depending on where on the screen the object is located. Object3D.onBeforeRender can be used to update the orientation on each frame. It might be useful to disable frustum culling using Object3D.frustumCulled = false; to ensure that the callback always is triggered.

    0 讨论(0)
  • 2020-12-31 10:10

    Try

    mesh.lookAt( camera.position );
    

    The local z-axis of the mesh should then point toward the camera.

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