Hello,
I am trying to get the billboarding effect to work on a callback
object(which contains some cgo's and other stuff). Billboarding is when
an object is always facing the camera (i.e. the rotation part of the
matrix is removed). I am using a callback object so that I can insert
rotate,translate commands every time the screen is updated. What is the
best way to do this?
First, I was thinking I could just get the current view and remove the
0-8 rotation matrix values. So I would:
original=get_view
reset
draw objects
transform_selection(new_matrix)
set_view(original)
this approach did not work...
Next, I was thinking I could abstract the camera position from the
get_view command, then using a dot product, get the angle between the
camera and the object. Now I could rotate along the cross-product of
the camera vector and the object vector by the - dot product. Thus
reversing the camera rotation for that specific object. Do I have to
first translate the object to the "origin of rotation" (the 9-12 values
of get_view() ?)
Is there a better/already implemented way to do this?
Any help would be appreciated.
Thanks,
Dan Kulp