All you need to do is add this to your rendering functionality (assuming "plane" is your billboard):
// Position billboard in 3D space
var up : Number3D = new Number3D(0, 1, 0);
Matrix3D.rotateAxis(camera.transform, up);
// Reorient the billboard in relation to the camera
plane.lookAt(camera, up);
plane.roll(180);
plane.pitch(180);
Which will give you:
Of course this functionality could be applied in a much smarter way; if I had a bunch of billboard shapes I'd probably store them in an array and update them all in a loop, but you get the idea.
One of the best things about this (apart from the fact that billboards are much less processor-intensive than full 3D geometry) is that you can set up multiple cameras, and the billboards will shift to point at the new perspective a different camera is used. Handy!
No comments:
Post a Comment