I have a plane geometry that is always set to face the camera via:
plane.lookAt(camera.position);
in the update loop. I am using OrbitControls
to control the camera. When rotating or zooming the scene, the plane continues to face the camera as expected.
However, after panning the scene, while the plane continues to face the camera, rotating the camera appears to rotate the plane as well, so that for example if the plane were to contain text, the text could appear rotated or even upside down to the viewer.
How can the plane be forced to stay aligned with the camera?
Example at jsFiddle: http://jsfiddle.net/Stemkoski/ptVLD/
The easiest solution is to simply add this to your animation loop:
plane.quaternion.copy( camera.quaternion );
Updated fiddle: http://jsfiddle.net/ptVLD/15/
Alternatively, you could use a THREE.Sprite
EDIT: Updated to three.js r.67
Somehow, just posting at StackOverflow seems to organize and clarify my thoughts :)
A better solution (for more robust billboarding) seems to be:
plane.rotation.setFromRotationMatrix( camera.matrix );
The jsFiddle code link in the question has been updated accordingly; however, now there is some "shuddering" of the camera/plane when rotating the camera after panning, so I suspect this solution is still not ideal and I would gladly appreciate and accept an answer which improves upon this one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With