Rotates the object/prim around axis at a rate of spinrate * llVecMag(axis) in radians per second with strength gain.

Syntax

void llTargetOmega( vector axis, float spinrate, float gain );

Forced delay: 0.0 seconds. Energy: 10.0.

Parameters

vector axis
arbitrary axis to rotate the object around
float spinrate
rate of rotation in radians per second
float gain
also modulates the final spinrate and disables the rotation behavior if zero

Specification

Physics

Link Sets

Caveats

Examples

//rotates the x axis once per second,
//  rotates the y axis 3 times per second, 
//  rotates the z axis once every two seconds.
//  combined the rate is about 3.20156 revolutions per second

llTargetOmega(<1.0,3.0,0.5>,TWO_PI,1.0);
 //Rotates very slowly around a sphere's local X axis .... Good for making a globe that rotates around a tilted axis

default
{
    state_entry()
    {
       llTargetOmega(<1.0,0.0,0.0>*llGetRot(),0.1,0.01);
    }
}
 //Rotates very slowly around a cylinder's local or global Z axis
 // .... Good for making a propeller that rotates regardless of initial orientation.

default
{
    state_entry()
    {
       llTargetOmega(llRot2Up(llGetLocalRot()), PI, 1.0);
    }
}
//To make an object return to its initial rotation when target omega stops, first make the object
//   rotate both client side and server side. Then, when you stop llTargetOmega, reset server side rotation.
//   Here's one way to do it.

integer iOn;
integer iStep;

default
{
    touch_start(integer total_number)
    {
        iOn = !iOn;
        if (iOn)
        {
            llTargetOmega(<0.0,0.0,1.0>, PI/8, 1.0); // Start rotating client side with llTargetOmega
            llSetTimerEvent(1.0);  //Start timer to rotate server side
        }
        else
        {
            llTargetOmega(<0.0,0.0,1.0>, 0.0, 0.0); //Stop client side rotation
            llSetTimerEvent(0.0);   //Stop timer and thus server side rotation
            llSetRot(ZERO_ROTATION);    //Set server side rotation to <0.0,0.0,0.0>
            iStep = 0;
        }
    }
    
    timer()
    {
        llSetRot(llAxisAngle2Rot(<0.0,0.0,1.0> ,++iStep *PI/8));  // Rotate at the same speed as llTargetOmega
    }
}

Notes

See also

Functions

Deep notes

Issues

History

Tests

Footnotes

  1. Early release notes were not very accurate or thorough, they sometimes included information about features added in previous releases or failed to include information about features added in that release.