问题
If you take a look at my fiddle:
http://jsfiddle.net/jmg157/Y35cQ/1/
You'll see I have grid labels on the cube axes. What I'd like to do is whenever the user rotates around the cube, have the text rotate as well so that the numbers are always facing the user.
I tried things like xMarks.rotation = camera.rotation
, where xMarks
are the text objects, but no success. Any suggestions would be greatly appreciated.
回答1:
three.js is now quaternion-based.
To make the text created with THREE.PlaneGeometry
face the camera, do this:
mesh.quaternion = camera.quaternion; // EDIT - see note below
Updated fiddle: http://jsfiddle.net/Y35cQ/2/
An alternative is to use THREE.Sprite
, which always faces the camera.
three.js r.63
EDIT - mesh.quaternion = camera.quaternion;
no longer works. You must use this pattern instead:
mesh.quaternion.copy( camera.quaternion );
three.js r.67
来源:https://stackoverflow.com/questions/20470516/rotate-text-to-face-user-when-camera-is-rotated