Jump to content
  • Advertisement
Sign in to follow this  
helix

Reversing camera view using Yaw, Pitch, and Roll

This topic is 4571 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

Our engine gives you the camera's orientation in yaw, pitch, and roll (as ints). I am unaccustomed to using these as I've always used a normalized vector for the direction in the past. What I want to do is find the reverse of the direction of the camera (for billboarding). Can I simply negate these values to find the reverse of the camera's orientation?

Share this post


Link to post
Share on other sites
Advertisement
<hypothesis> Add/subtract 180 degrees (or pi, if radians) from each of Yaw/Pitch/Roll. Essentially all you're doing is making a 180-turn on each of its orientations. </hypothesis>

Untested, but it should work. :)

Share this post


Link to post
Share on other sites
At some point you must be converting your Euler angles to a matrix for interface with an API, I would imagine. If so, I would just take this matrix and construct the billboard matrix from it directly, and not deal with the Euler angles for that step at all. (Please ask if you need any clarification...)

Share this post


Link to post
Share on other sites
Subtracting 180 won't work because the numbers can be very big -- much bigger than 180. Getting at the matrix isn't an option either due to the nature of the engine and the environment (language) I'm coding in.

I'm thinking I'd probably have to convert these values to a direction, reverse it, then convert back to yaw, pitch, and roll.

Share this post


Link to post
Share on other sites
Quote:
Getting at the matrix isn't an option either due to the nature of the engine and the environment (language) I'm coding in.

I'm thinking I'd probably have to convert these values to a direction, reverse it, then convert back to yaw, pitch, and roll.


You must be missing that ONE direction isn't enough, unless your engine is limited to cameras that always have the same "up" direction. Not to mention that the required up and view direction ARE the second and third vector in a matrix with the first being the cross product, so I fail to see how you could extract the direction but not the full matrix.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!