[opensource-dev] converting degrees into quaternions

Sophira Crystal sl-dev at theblob.org
Tue Jul 31 05:29:35 PDT 2012


Hi,

You don't convert degrees to quaternions directly. You convert vectors
to rotations (which are quarternions), and you do that with the
llEuler2Rot function.

As for the rest of your query, you might find
http://wiki.secondlife.com/wiki/Rotation helpful - I don't know much
about rotations, but I bet the answer you want is probably in there
somewhere.

I hope my reply's been helpful, even though I personally don't know much...

 - Sophie.

On Tue, Jul 31, 2012 at 11:54 AM, CJ Davies <cjohndavies at gmail.com> wrote:
> I've been struggling with this for 2 days now & am no closer to working
> it out (despite investigating all sorts of examples online, including
> the SL wiki).
>
> I have a accelerometer/magnetometer that tells me orientation via
> compass bearing, pitch & roll. All of these are in degrees which can
> easily be converted to radians via foo*DEG_TO_RAD. I want to plug these
> values into llcoordframe methods to control where the camera points. All
> of the llcoordframe stuff works in quaternions & I can't for the life of
> me convert properly.
>
> I've just tried following this approach -->
> http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm
>
> But this results in output like this --> http://paste2.org/p/2089138
>
> Note how the calculated w/x/y/z values change drastically with tiny
> changes in the bearing/pitch/roll, eg between lines 43 & 50 (the
> accelerometer/magnetometer was motionless on the desk at the time!).
>
> Any help greatly appreciated.
>
> Regards,
> CJ Davies
> _______________________________________________
> Policies and (un)subscribe information available here:
> http://wiki.secondlife.com/wiki/OpenSource-Dev
> Please read the policies before posting to keep unmoderated posting privileges


More information about the opensource-dev mailing list