Difference between revisions of "User:Dora Gustafson/Replacing llTargetOmega/function"

From Second Life Wiki
Jump to navigation Jump to search
m (→‎Replacing llTargetOmega, the function: Replaced <source> with <syntaxhighlight>)
 
Line 1: Line 1:
== Replacing llTargetOmega, the function ==
== Replacing llTargetOmega, the function ==
<source lang="lsl2">
<syntaxhighlight lang="lsl2">
KeyFramedOmega( vector axis, float spinrate)
KeyFramedOmega( vector axis, float spinrate)
{
{
Line 12: Line 12:
     }
     }
}
}
</source>
</syntaxhighlight>

Latest revision as of 18:17, 22 October 2022

Replacing llTargetOmega, the function

KeyFramedOmega( vector axis, float spinrate)
{
    llSetKeyframedMotion( [], []);
    if ( spinrate )
    {
        float v = TWO_PI/3.0;
        if ( spinrate < 0 ) v = -v;
        list L = [llAxisAngle2Rot( axis/llGetRot(), v), v/spinrate];
        llSetKeyframedMotion( L+L+L, [KFM_DATA, KFM_ROTATION, KFM_MODE, KFM_LOOP]);
    }
}