Difference between revisions of "LlEuler2Rot"
Jump to navigation
Jump to search
m |
(Vector is in radians. Typo: llRot2Euler -> llEuler2Rot.) |
||
Line 5: | Line 5: | ||
|func_desc | |func_desc | ||
|return_text=representation of Euler Angles '''v'''. | |return_text=representation of Euler Angles '''v'''. | ||
|spec=The Euler angle vector is converted to a rotation by doing the rotations around the 3 axes in Z, Y, X order. So | |spec=The Euler angle vector (in radians) is converted to a rotation by doing the rotations around the 3 axes in Z, Y, X order. So llEuler2Rot(<1.0, 2.0, 3.0> * DEG_TO_RAD) generates a rotation by taking the zero rotation, a vector pointing along the X axis, first rotating it 3 degrees around the global Z axis, then rotating the resulting vector 2 degrees around the global Y axis, and finally rotating that 1 degree around the global X axis. | ||
|caveats | |caveats | ||
|constants | |constants | ||
Line 12: | Line 12: | ||
state_entry() | state_entry() | ||
{ | { | ||
vector input = <73.0, -63.0, 20.0> * DEG_TO_RAD; | vector input = <73.0, -63.0, 20.0> * DEG_TO_RAD; | ||
rotation rot = llEuler2Rot(input); | rotation rot = llEuler2Rot(input); | ||
llSay(0,"The Euler2Rot of "+(string)input+" is: "+(string)rot ); | llSay(0,"The Euler2Rot of "+(string)input+" is: "+(string)rot ); |
Revision as of 19:32, 17 April 2008
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: rotation llEuler2Rot( vector v );16 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Returns a rotation representation of Euler Angles v.
• vector | v |
Specification
The Euler angle vector (in radians) is converted to a rotation by doing the rotations around the 3 axes in Z, Y, X order. So llEuler2Rot(<1.0, 2.0, 3.0> * DEG_TO_RAD) generates a rotation by taking the zero rotation, a vector pointing along the X axis, first rotating it 3 degrees around the global Z axis, then rotating the resulting vector 2 degrees around the global Y axis, and finally rotating that 1 degree around the global X axis.
Caveats
Examples
<lsl>default {
state_entry() { vector input = <73.0, -63.0, 20.0> * DEG_TO_RAD; rotation rot = llEuler2Rot(input); llSay(0,"The Euler2Rot of "+(string)input+" is: "+(string)rot ); }}</lsl>
Notes
<lsl>v/=2; rotation k = <0.0, 0.0, llSin(v.z), llCos(v.z)> * <0.0, llSin(v.y), 0.0, llCos(v.y)> * <llSin(v.x), 0.0, 0.0, llCos(v.x)>;</lsl>