User talk:LindaB Helendale/rot2roll pitch yaw

From Second Life Wiki
Jump to navigation Jump to search

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)