Difference between revisions of "User talk:LindaB Helendale/rot2roll pitch yaw"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with "If you just want to change the order, an easier might be something like this: <source lang="lsl2"> vector rot2roll_pitch_yaw(rotation r) { vector ypr = llRot2Euler(<r.z,...")
 
m
 
Line 1: Line 1:
If you just want to change the order, an easier might be something like this:
If you just want to change the order, an easier way might be something like this:


<source lang="lsl2">
<source lang="lsl2">

Latest revision as of 15:28, 8 August 2015

If you just want to change the order, an easier way might be something like this:

vector rot2roll_pitch_yaw(rotation r)
{
    vector ypr = llRot2Euler(<r.z, r.y, r.x, r.s>);
    return <ypr.z, ypr.y, ypr.x>;
}
 
rotation roll_pitch_yaw2rot(vector rpy)
{
    vector ir = llEuler2Rot(<rpy.z, rpy.y, rpy.x>);
    return <ir.z, ir.y, ir.x, ir.s>;
}

I haven't tested it but it should be correct. If the handedness is wrong just add some negatives. -- Strife (talk|contribs) 15:27, 8 August 2015 (PDT)