Difference between revisions of "Interpolation/Linear/Rotation"
< Interpolation | Linear
Jump to navigation
Jump to search
(Created page with "{{LSL_Function |mode=user |func=rLin |p1_type=rotation|p1_name=x |p2_type=rotation|p2_name=y |p3_type=float|p3_name=t |return_type=rotation |return_value=returns the interpolatio…") |
m |
||
Line 13: | Line 13: | ||
if(ang > PI) ang -= TWO_PI; | if(ang > PI) ang -= TWO_PI; | ||
return x * llAxisAngle2Rot(llRot2Axis(y/x)*x, ang*t); | return x * llAxisAngle2Rot(llRot2Axis(y/x)*x, ang*t); | ||
}</lsl> | } | ||
// Released into public domain. By Nexii Malthus.</lsl> | |||
|examples=<lsl> | |examples=<lsl> | ||
rotation x = llRot2Euler(<0,0,30*DEG_TO_RAD>); | rotation x = llRot2Euler(<0,0,30*DEG_TO_RAD>); |
Revision as of 03:37, 14 September 2011
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: rotation rLin( rotation x, rotation y, float t );
Interpolates between two rotation values in a linear fashion.
Returns a rotation
• rotation | x | |||
• rotation | y | |||
• float | t |
Specification
<lsl>rotation rLin(rotation x, rotation y, float t) {
float ang = llAngleBetween(x, y); if(ang > PI) ang -= TWO_PI; return x * llAxisAngle2Rot(llRot2Axis(y/x)*x, ang*t);
} // Released into public domain. By Nexii Malthus.</lsl>
Examples
<lsl> rotation x = llRot2Euler(<0,0,30*DEG_TO_RAD>); rotation y = llRot2Euler(<0,0,90*DEG_TO_RAD>);
rotation z = rLin(x, y, 0.5); // z equivalent to euler rotation of 60 degrees on Z axis</lsl>