Difference between revisions of "LlTargetOmega"

From Second Life Wiki
Jump to navigation Jump to search
m (child prims)
Line 8: Line 8:
|p3_type=float|p3_name=gain|p3_desc=also modulates the final spinrate and disables the rotation behavior if zero
|p3_type=float|p3_name=gain|p3_desc=also modulates the final spinrate and disables the rotation behavior if zero
|func_footnote
|func_footnote
|func_desc=Rotates the object around '''axis''' at '''spinrate''' * [[llVecMag]]('''axis''') in radians per second with strength '''gain'''.
|func_desc=Rotates the object/prim around '''axis''' at '''spinrate''' * [[llVecMag]]('''axis''') in radians per second with strength '''gain'''.
|examples=<lsl>//rotates the x axis once per second,
|examples=<lsl>//rotates the x axis once per second,
//  rotates the y axis 3 times per second,  
//  rotates the y axis 3 times per second,  
Line 33: Line 33:
|also_tests={{LSL DefineRow||[[llTargetOmega test]]|}}
|also_tests={{LSL DefineRow||[[llTargetOmega test]]|}}
|notes=* Use [[llVecNorm]] on '''axis''' so that '''spinrate''' actually represents the rate of rotation.
|notes=* Use [[llVecNorm]] on '''axis''' so that '''spinrate''' actually represents the rate of rotation.
* Set the gain to zero to disable and remove the rotation behavior, eg <code>llTargetOmega([[ZERO_VECTOR]], 0, 0);</code>
* Set the gain to zero to disable and remove the rotation behavior, eg llTargetOmega(ZERO_VECTOR, 0, 0);
** A '''spinrate''' of 0 with a nonzero '''gain''' causes the object to try to stop all spin, rather than simply clearing a previous llTargetOmega() call.
** A spinrate of 0 with a nonzero gain causes the object to try to stop all spin, rather than simply clearing a previous llTargetOmega() call.
* If there are other forces applied to a prim together with llTargetOmega(), (like using [[llSetForce]] to make the object float), use <code>llTargetOmega(-[[llGetOmega]](), 0., 1.)</code> to cancel spin. Note that the '''gain''' must be non-zero, but not necessarily 1.
* If there are other forces applied to a prim together with llTargetOmega(), (like using llSetForce to make the object float), use llTargetOmega(-llGetOmega(), 0., 1.) to cancel spin. Note that the gain must be non-zero, but not necessarily 1.


|cat1=Physics
|cat1=Physics

Revision as of 21:39, 10 February 2010

Summary

Function: llTargetOmega( vector axis, float spinrate, float gain );

Rotates the object/prim around axis at spinrate * llVecMag(axis) in radians per second with strength 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

Specification

Physics

  • If the object is not physical then the effect is entirely client side. The rotation experienced by the user cannot be detected or queried by script.
  • If the object is physical then the physical representation is updated regularly. The rotation experienced by the user can be detected or queried by script.

Link Sets

  • If the script is attached to the root prim, the entire object rotates around the region axis
    • If the object is attached then it rotates around the attachment axis
  • If the script is attached to a child prim, the prim rotates around the local axis
    • A Child prim can rotate around its own axis while the entire object rotates around another axis.

Caveats

  • If the object is not physical then the rotation is only a client side effect and it will collide as non-moving geometry.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl>//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);</lsl>

Notes

  • Use llVecNorm on axis so that spinrate actually represents the rate of rotation.
  • Set the gain to zero to disable and remove the rotation behavior, eg llTargetOmega(ZERO_VECTOR, 0, 0);
    • A spinrate of 0 with a nonzero gain causes the object to try to stop all spin, rather than simply clearing a previous llTargetOmega() call.
  • If there are other forces applied to a prim together with llTargetOmega(), (like using llSetForce to make the object float), use llTargetOmega(-llGetOmega(), 0., 1.) to cancel spin. Note that the gain must be non-zero, but not necessarily 1.

Deep Notes

Search JIRA for related Issues

Tests

•  llTargetOmega test

Signature

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