Patched one hole in floating text
Andrew Smith | 24 September, 2008 | 17:36
The idea behind adding addFlotingText() to the API was to give the user a way to display text inside the 3D Canvas. Intuitively, but certainly not technically trivial - the text should always face the user no matter where the camera is.
I took this challenge on without much hope, it’s been a very long time since I last did any 3D math. But somehow I managed to get it to work. I guess at least some of what Evan and Chris S. taught me stuck. Have a look at the new index.html, it has a moving camera, a teapot, and a floating text. The teapot does not float, so it appears to move away, while the text stays where it was in the beginning.
Sadly this wasn’t the only hole in the floating text. If the camera is rotated (as opposed to moved), my childish math falls to pieces, and the text sinks. I think I’ll leave that for Andor to fix, he probably knows exactly how to do it. The code is in the first ‘if’ in Model::update()
Also the text is upside down. An easy way to fix that would be to rotate the plane model it’s on, but perhaps it would be better to fix the root of the problem, which is (I suspect), the plane model itself, defined in Scene::addTextToModel()
