Bounding Box Rotation and glRotatef problem.

Started by
0 comments, last by haegarr 17 years, 7 months ago
I have Bounding Box class which has: Vector3D m_min; Vector3D m_max; Vector3D m_position; The position is: m_position=m_max-m_min; I need to rotate the object. After applying glRotatef function the min and max vectors are changes but, In the real life the values are the same. How to calculate the new min and max position? May be it’s better to calculate this without glRotatef in order to control the object? Please help.
Advertisement
You should use glRotate, glTranslate, glScale, and glMultMatrix only for actual rendering purposes. Its better to implement a class for homogeneous matrices to track transformations yourself. Apply the belonging transformations to such a matrix, and apply the matrix to the bbox, then use the result for collision purposes.


BTW: Shouldn't m_position be (m_max+m_min)*0.5? Because m_max-m_min defines the extent of the box, and not its position...

This topic is closed to new replies.

Advertisement