• Advertisement
Sign in to follow this  

Rotating around an object using the camera

This topic is 2736 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

I've undestood how the frustum have to be set (http://www.gamedev.net/community/forums/topic.asp?topic_id=585641), but now I have a trouble to rotate the camera on the X-axis around an object centered in (0, 0, 0).

I rotate on Y-axis modifying only the position X and Z with sin and cos.
I rotate on Z-axis modifying only the up vector X and Y params.

Initialy the camera is in position (0, 0, 2) looking to (0, 0, 0) with up vector (0, 1, 0).

If I rotate on the X-axis modifying only the Y and Z params there's a moment, when view vector (at - pos) is equal to up vector (0, 1, 0) and equal to (0, -1, 0), where the camera rotates 180º on Y-axis...

Sure this question has been answered before a lot of times...


Thanks.

Share this post


Link to post
Share on other sites
Advertisement
You want to do the transformations all together

Vector3( sin( pitch ) * sin( yaw ), cos( yaw ), cos( pitch ) * sin( yaw ) )

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement