llSetAngularVelocity
void llSetAngularVelocity(vector AngVel, integer Local)Sets an object's angular velocity to AngVel, in local coordinates if Local == TRUE (if the script is physical).
Has no effect on non-physical objects.
Parameters
-
AngVel(vector) - The angular velocity to set the object to.
-
Local(integer) - If TRUE, the AngVel is treated as a local directional vector instead of a regional directional vector.
Consider an object with mass M and gravity disabled (uniform cube, single prim, center of mass at center):
Using llSetAngularVelocity:
llSetAngularVelocity(<0,0,1>, TRUE);Starts rotation around the Z local axis with initial omega = 1 radian/second, gradually slowing down over time until rotation stops.
Compared with llApplyRotationalImpulse:
llApplyRotationalImpulse(<0,0,1>, TRUE);Starts rotation around the Z local axis with initial omega = 1/M radian/second (inversely proportional to mass), gradually slowing down over time.
Compared with llTargetOmega:
llTargetOmega(<0.0,0.0,1.0>, 1.0, 1.0);For physical objects, starts rotation around the Z local axis with omega = 1 radian/second, but unlike llSetAngularVelocity, does not slow down over time—maintains constant rotation.
- This function applies rotational velocity independent of object mass, unlike llApplyRotationalImpulse which divides the impulse by mass
- Only affects physical objects; has no effect on non-physical objects
- The angular velocity will gradually decrease over time due to friction
- For permanent continuous rotation without decay, use llTargetOmega instead
- When
Localis TRUE, the vector is treated as a local directional vector; when FALSE, it’s regional