three.js TextGeometry: text alignment gets messed up after re-setting the rotation

a 夏天 提交于 2019-12-25 02:28:10

问题


I have created a THREE. TubeGeometry and using the THREE.TextGeometry added the text to the tube created. The tube is then added to scene. Also the I have set the text rotation to camera rotation. The code snippet is below

text.rotation = camera.rotation;
text.lookAt(camera.position);

My application has a button by which I can reset the original position of my tube geometry. Internally, this is done by reseting the camera to its originally position.

Initially, when the page loads up, the tube and text are properly aligned and face the user. But when I rotate the tube and reset it to original position, the tube is properly getting back to original position but text is randomly facing to any direction.

My basic requirement is the text should always face the user. I have followed the steps mentioned in another related query:

TextGeometry to always face user?

But even though I have coded in same way as suggested, I am facing the above mentioned issue. Please point what I am missing?

Note: I am using perspective camera.

来源:https://stackoverflow.com/questions/20398652/three-js-textgeometry-text-alignment-gets-messed-up-after-re-setting-the-rotati

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!