Billboard matrix to rotate about the y axis

Started by
1 comment, last by pan narrans 20 years, 8 months ago
I''m currently trying to add a billboard node to my scene graph. I''ve searched the boards and have learnt how to achieve spherical rotation using the transposed view matrix.
Math::cMatrix4 Orientate = Camera->GetViewTransform().Transpose();

Orientate[3][0] = 0.0f;
Orientate[3][1] = 0.0f;
Orientate[3][2] = 0.0f;

m_WorldRotation = m_WorldRotation * Orientate; 
That results in the objects being rotated to face a plane perpendicular to the viewpoint. However, I am having trouble rotating the objects about only one axis (cylindrical rotation). Can anyone help, please? Thanx a lot pan narrans | My Website | Study + Hard Work + Loud Profanity = Good Code
Minister of Propaganda : leighstringer.com : Nobody likes the man who brings bad news - Sophocles (496 BC - 406 BC), Antigone
Advertisement
Maybe this will help:
http://www.mvps.org/directx/articles/view_oriented_billboards.htm

.lick
I think I've got it right, so I'll post it in the interest of people who might search at a later date

Math::cVector3 Dir = Camera->GetWorldTranslation() - m_WorldTranslation;Math::cMatrix3 Rotate;if(Dir.m_X > 0.0f)    Rotate.YRotation(-atanf(Dir.m_Z / Dir.m_X) + Math::PI_2);else    Rotate.YRotation(-atanf(Dir.m_Z / Dir.m_X) - Math::PI_2);m_WorldRotation = m_WorldRotation * Rotate; 


pan narrans | My Website | Study + Hard Work + Loud Profanity = Good Code

[edited by - pan narrans on August 7, 2003 5:43:43 PM]
Minister of Propaganda : leighstringer.com : Nobody likes the man who brings bad news - Sophocles (496 BC - 406 BC), Antigone

This topic is closed to new replies.

Advertisement