Sign in to follow this  
Libinson David

Bounding Box Rotation and glRotatef problem.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this