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
Billboard matrix to rotate about the y axis
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.
I think I've got it right, so I'll post it in the interest of people who might search at a later date
pan narrans | My Website | Study + Hard Work + Loud Profanity = Good Code
[edited by - pan narrans on August 7, 2003 5:43:43 PM]
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement