Jump to content

Convert Yaw and Pitch into a quaternion


Recommended Posts

So Ive got a problem where I need to convert the rotationYaw and rotationPitch into the standard (x,y,z,angle) format. I tried seeing how Minecraft does this when rendering but it does the crappy trick of calling the glRotateF twice with (0,1,0,yaw) and (1,0,0,pitch).


What would I need to do to convert the pitch and yaw into something like (x,y,z,angle)?


Edit: Please don't ask why, Im just wondering what openGL would be doing to combine the (0,1,0,yaw) and (1,0,0,pitch)


Another thing, the yaw and pitch need to be in radian format for this, not angle format like openGL uses

Link to comment
Share on other sites

You simply can't.

Since quaternion cannot represent a coordinate system, you need something with more data than that, like Matrix.

In OpenGL, (0,1,0,yaw) and (1,0,0,pitch) is changed into matrix form, and multiplied.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.