Differences

This shows you the differences between two versions of the page.

 wiki:scripting_portal:lsl_functions:llaxes2rot [2018/11/20 17:26]Royale Mobian created wiki:scripting_portal:lsl_functions:llaxes2rot [2019/07/22 19:11] (current)Royale Mobian 2019/07/22 19:11 Royale Mobian 2018/11/20 17:26 Royale Mobian created 2019/07/22 19:11 Royale Mobian 2018/11/20 17:26 Royale Mobian created Line 1: Line 1: ====== llAxes2Rot ====== ====== llAxes2Rot ====== - ===== Introduction ===== + **[[wiki:​scripting_portal:​lsl_functions|Function]]:​ [[wiki:​scripting_portal:​lsl_types:​rotation|rotation]] llAxes2Rot( [[wiki:​scripting_portal:​lsl_types:​vector|vector]] fwd, [[wiki:​scripting_portal:​lsl_types:​vector|vector]] left, [[wiki:​scripting_portal:​lsl_types:​vector|vector]] up );**\\ - + Returns a rotation that is defined by the 3 coordinate axes - + * vector fwd - ==== Example use cases: ==== + * vector left + * vector up + All three vectors must be mutually orthogonal unit vectors. ===== Examples ===== ===== Examples ===== - + default + { + state_entry() + { + vector i = < 1.0, 0.0, 0.0>; + vector j = < 0.0, 1.0, 0.0>; + vector k = < 0.0, 0.0, 1.0>; + + rotation rot = llAxes2Rot( j, -i, k ); + + llSay(0, (string) (llRot2Euler(rot) * RAD_TO_DEG) ); + } + } + ​ + This scripts displays: + <​code>​ + Object: <​-0.00000,​ 0.00000, 90.00000>​ + ​ + which shows that (**j**, -**i**, **k**) is obtained by rotating (**i**, **j**, **k**) 90 degrees around **z** direction. + ==== Notes ==== + Technically,​ only the first two vectors are needed to define this rotation, which can be done by calling any of these: + + llAxes2Rot(fwd,​ left, fwd % left); + llAxes2Rot(left % up, left, up); + llAxes2Rot(fwd,​ up % fwd, up);