XnaCollision Frustum rotation problem

Started by
-1 comments, last by Aleks Le 10 years, 4 months ago

Hello everyone, this is my fist post, sorry if it is in the wrong section.

I am desperate for help, ive been trying to solve this problem for 2 days and its driving me crazy.

I Am working with Directx11 Api, for collisions i am using xnacollisions.h/cpp that can be found in the directxSDK examples;

xnacollisions provide me with all sorts of collision Boxes/spheres, it also allows me to create a Frustum from the camera view.

here is my problem.

(all functions with prefix XNA, are from xnacollisions)

XNAComputeFrustumFromProjection, creates the frustum from the camera values.

i then need to set the origin of the m_camFrustum, which is the position of the camera.

and then i also need to set the orientation of m_camFrustum which is the Quaternion representation of angles.

The camera in this game im working on is based on Euler angles.

and i found ways of converting euler to Quaternion.

The problem is i can not get the angles from my camera. i need to extract them from the matrix..?
another way i was thinking is calculating the angles(x,y,z) from the camera position to the cameraLookAt Position.

as i understand function XMMatrixLookAtLH() calcualtes taht angle and stores it in the cameraMatrix automatically.

How can i get the angles and store them in quaternion representation in order to rotate the frustum accordingly to the camera rotation?

Thanks, and sorry for mistakes if there are any.

This topic is closed to new replies.

Advertisement