Difference between revisions of "PRIM OMEGA"

From Second Life Wiki
Jump to navigation Jump to search
m (Fix the extra caveat to make it appear)
 
(10 intermediate revisions by 6 users not shown)
Line 3: Line 3:
{{#vardefine:omega_const|{{LSL Const|PRIM_OMEGA|integer|18|c=Used to {{GetSet|{{{1|}}}|get the object's llTargetOmega settings|rotate the object at on the given axis at the given rate|/}} }}}}
{{#vardefine:omega_const|{{LSL Const|PRIM_OMEGA|integer|18|c=Used to {{GetSet|{{{1|}}}|get the object's llTargetOmega settings|rotate the object at on the given axis at the given rate|/}} }}}}


{{#vardefine:facetable|{{#var:facetable}}
{{#vardefine:caveats|{{#var:caveats}}
{{!}}-
*[[PRIM_OMEGA]] on nonphysical objects, and child prims of physical objects, is only a client side effect; the object or prim will collide as non-moving geometry.
{{!}} [ {{#var:omega_const}} ]
*[[PRIM_OMEGA]] cannot be used on avatars sitting on the object. It will emit the error message "PRIM_OMEGA disallowed on agent".
{{!}} {{#var:return}} }}
*If [[PRIM_OMEGA]] does not appear to be working, make sure that that Develop > Network > Velocity Interpolate Objects is enabled on the viewer.
*In the parameters returned by <code>llGetPrimitiveParams([PRIM_OMEGA])</code>, the vector is normalized, and the spinrate is multiplied by the magnitude of the original vector.}}


{{#vardefine:caveats|* [[PRIM_OMEGA]] is only available on RC BlueSteel [[Release Notes/Second Life RC BlueSteel/11#11.06.20.233291|as of 2011-06-22]]'''
{{#vardefine:p_axis_desc|arbitrary axis to rotate the object around}}
*[[PRIM_OMEGA]] on nonphysical objects is only a client side effect, and the object will collide as non-moving geometry.
{{#vardefine:p_spinrate_desc|rate of rotation in radians per second}}
*If [[PRIM_OMEGA]] does not appear to be working, make sure that that Develop > Network > Velocity Interpolate Objects is enabled on the viewer.}}
{{#vardefine:p_gain_desc|also modulates the final spinrate and disables the rotation behavior if zero}}


}}</onlyinclude>{{#if:
}}</onlyinclude>{{#if:


}}{{LSL Constant
}}{{LSL Constant
|inject-2={{LSL PrimitiveParam Categorize|Prim}}
|name=PRIM_OMEGA
|name=PRIM_OMEGA
|type=integer
|type=integer
|value=32
|value=32
|desc=Used to make the object spin at the specified axis and rate, or retrieve spin settings. See [[llTargetOmega]] for specification.
|desc=Used to make the object spin at the specified axis and rate, or retrieve spin settings. See [[llTargetOmega]] for specification.
|examples=<lsl>
|examples=<source lang="lsl2">
// Set this prim rotating
// Set this prim rotating
llTargetOmega(<1.0,3.0,0.5>, TWO_PI, 1.0);
llTargetOmega(<1.0,3.0,0.5>, TWO_PI, 1.0);


// Read back this prim's current target omega
// Read back this prim's current target omega
list current_omega = llListToList( llGetPrimitiveParams([PRIM_OMEGA]); // should be [PRIM_OMEGA, axis, spinrate, gain]
list current_omega = llGetPrimitiveParams([PRIM_OMEGA]); // returns [axis, spinrate, gain]
vector axis = llList2Vector(current_omega, 1); // Should be <1.0,3.0,0.5>
vector axis = llList2Vector(current_omega, 0); // Should be llVecNorm(<1.0,3.0,0.5>)
float spinrate = llList2Float(current_omega, 2); // Should be TWO_PI
float spinrate = llList2Float(current_omega, 1); // Should be TWO_PI*llVecMag(<1.0,3.0,0.5>)
float gain = llList2Float(current_omega, 3); // Should be 1.0
float gain = llList2Float(current_omega, 2); // Should be 1.0


// Set all child prims rotating
// Set all child prims rotating
llSetLinkPrimitiveParamsFast(LINK_ALL_CHILDREN, [PRIM_OMEGA, <1.0,3.0,0.5>, TWO_PI, 1.0]);
llSetLinkPrimitiveParamsFast(LINK_ALL_CHILDREN, [PRIM_OMEGA, <1.0,3.0,0.5>, TWO_PI, 1.0]);
</lsl>
</source>
Also, can use llSetPrimitiveParams for the root prim.
<source lang="lsl2">// will need two prims linked together for this script.
default
{
    state_entry()
    {
        // make some sort of rotation angle for the omega...
        vector rotationAngle = <2.3, 5.5, 9.7> * llTan(85);
       
        // rotate the main prim slowly using the same rotataion angle, rate, and gain...
        llSetPrimitiveParams([ PRIM_OMEGA, rotationAngle * 0.3, 1.0, 1.0 ]);
       
        // rotate the link satellite prim separately around its own axis
        // it will rotate also around the main prim because the main prim is rotating.
        llSetLinkPrimitiveParams(2, [ PRIM_OMEGA, rotationAngle, 1.0, 1.0 ]);
    }
}
</source>
|constants
|constants
|pa={{LSL Constant/List|i_front=[&#32;{{#var:omega_const}},&#32;|i_end=&nbsp;]
|pa={{LSL Constant/List|i_front=[&#32;{{#var:omega_const}},&#32;|i_end=&nbsp;]
Line 55: Line 75:
|events
|events
|location
|location
|history=*Introduced in [[Release Notes/Second Life RC BlueSteel/11#11.06.20.233291|Second Life RC BlueSteel 11.06.20.233291]], June 22, 2011  
|history=*Introduced in [[Release Notes/Second Life RC BlueSteel/11#11.06.20.233291|Second Life RC BlueSteel 11.06.20.233291]], June 22, 2011
|cat1=Prim
*Rolled to main server channel the week of 7/11/2011
|cat1
|cat2=Effects
|cat2=Effects
|cat3=Physics
|cat3=Physics
|cat4=Rotation
|cat4=Rotation
}}
}}

Latest revision as of 12:07, 10 November 2022

Description

Constant: integer PRIM_OMEGA = 32;

The integer constant PRIM_OMEGA has the value 32

Used to make the object spin at the specified axis and rate, or retrieve spin settings. See llTargetOmega for specification.

llSetPrimitiveParams

[ PRIM_OMEGA, vector axis, float spinrate, float gain ]
• 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

When used with llSetPrimitiveParams & llSetLinkPrimitiveParams

llGetPrimitiveParams

llGetPrimitiveParams([ PRIM_OMEGA ]);

Returns the listvector axis, float spinrate, float gain ]

• 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

Caveats

  • PRIM_OMEGA on nonphysical objects, and child prims of physical objects, is only a client side effect; the object or prim will collide as non-moving geometry.
  • PRIM_OMEGA cannot be used on avatars sitting on the object. It will emit the error message "PRIM_OMEGA disallowed on agent".
  • If PRIM_OMEGA does not appear to be working, make sure that that Develop > Network > Velocity Interpolate Objects is enabled on the viewer.
  • In the parameters returned by llGetPrimitiveParams([PRIM_OMEGA]), the vector is normalized, and the spinrate is multiplied by the magnitude of the original vector.


Related Articles

Examples

// Set this prim rotating
llTargetOmega(<1.0,3.0,0.5>, TWO_PI, 1.0);

// Read back this prim's current target omega
list current_omega = llGetPrimitiveParams([PRIM_OMEGA]); // returns [axis, spinrate, gain]
vector axis = llList2Vector(current_omega, 0); // Should be llVecNorm(<1.0,3.0,0.5>)
float spinrate = llList2Float(current_omega, 1); // Should be TWO_PI*llVecMag(<1.0,3.0,0.5>)
float gain = llList2Float(current_omega, 2); // Should be 1.0

// Set all child prims rotating
llSetLinkPrimitiveParamsFast(LINK_ALL_CHILDREN, [PRIM_OMEGA, <1.0,3.0,0.5>, TWO_PI, 1.0]);

Also, can use llSetPrimitiveParams for the root prim.

// will need two prims linked together for this script.
default
{
    state_entry()
    {
        // make some sort of rotation angle for the omega...
        vector rotationAngle = <2.3, 5.5, 9.7> * llTan(85); 
        
        // rotate the main prim slowly using the same rotataion angle, rate, and gain...
        llSetPrimitiveParams([ PRIM_OMEGA, rotationAngle * 0.3, 1.0, 1.0 ]);
        
        // rotate the link satellite prim separately around its own axis 
        // it will rotate also around the main prim because the main prim is rotating.
        llSetLinkPrimitiveParams(2, [ PRIM_OMEGA, rotationAngle, 1.0, 1.0 ]);
    }
}

Deep Notes

History

Search JIRA for related Issues

Signature

integer PRIM_OMEGA = 32;