|
Title: Converting between orientation vector and Euler angles? Post by: Orz on October 29, 2013, 12:26:17 PM I would like to set the orientation of my game entities through either orientation vectors or through Euler angles, e.g. setDirection(eye, lookAt, up) or setRotation(-45, 45, -45).
Due to rounding errors accumulating, I can't just store the orientation as a transformation matrix and update it over time. Right now I store it as Euler angles. But there doesn't seem to be a way to convert orientation vectors to Euler angles with GLM. Does anyone have suggestions on how to do this, or maybe another way to store the orientation? Title: Re: Converting between orientation vector and Euler angles? Post by: ThemsAllTook on October 29, 2013, 01:21:24 PM If you're working with 3D orientations, quaternions are almost always the best tool for the job. They can be a bit confusing mathematically, but in essence they simply represent an axis and an angle, which allows you to express any rotation with 4 floats. Euler angles are quite problematic - they can represent arbitrary rotations, but working with them is very unintuitive beyond the most basic transformations.
I wrote a tutorial on quaternions once: http://sacredsoftware.net/tutorials/Quaternions/Quaternions.xhtml Be sure to try out the companion application linked from the bottom of the page! Title: Re: Converting between orientation vector and Euler angles? Post by: 5I6VATR on October 30, 2013, 06:59:13 AM ^ but
did u try googel first Title: Re: Converting between orientation vector and Euler angles? Post by: Orz on October 30, 2013, 05:47:10 PM If you're working with 3D orientations, quaternions are almost always the best tool for the job. It looks like they will do the trick, thanks! I thankfully don't have to deal with the linear algebra, because GLM has functions that operate on quaternions. Title: Re: Converting between orientation vector and Euler angles? Post by: S16VATR on October 30, 2013, 06:35:06 PM It looks like they will do the trick, thanks! I thankfully don't have to deal with the linear algebra, because GLM has functions that operate on quaternions. guna take you liek a week to get them to work caus u need a scienc degre to understand how tehy work Title: Re: Converting between orientation vector and Euler angles? Post by: ThemsAllTook on October 30, 2013, 07:52:56 PM guna take you liek a week to get them to work caus u need a scienc degre to understand how tehy work Fortunately quaternions are a thing that can be used without understanding all of the inner workings of them. Rotating, multiplying, converting to a matrix, etc. are all straightforward enough if you have a high-level interface. Title: Re: Converting between orientation vector and Euler angles? Post by: S16VATR on October 30, 2013, 08:10:19 PM Fortunately quaternions are a thing that can be used without understanding all of the inner workings of them. Rotating, multiplying, converting to a matrix, etc. are all straightforward enough if you have a high-level interface. ya but thats da american way as long as your code work who give a fuck how it works |