The Rotate Command

Usage

rotate [x] y [z] [sync OR nosync] [time=time] [loop OR noloop] [reset OR noreset] [wait=wait] [name=name] [smooth]

Description

The rotate command causes an object to rotate continuously around one or more axes. The rotation occurs around the origin of the object. Thus, applying the rotate command to an off-center object can cause an object to "wobble", or even to spin in circles if it is far enough off-center.

The only required argument is y, which specifies the rotation speed around the y-axis in RPM (rotations per minute). When creating an object that rotates around the x or z axes, or more than one axis simultaneously, all 3 axes must be specified. The maximum allowable RPM for any of the 3 axes is 50,000.

Sync / Nosync

The sync and nosync flags indicate whether the rotation is synchronized to universe time. The default is sync. By synchronizing the rotation to universe time, it is possible to create a rotating object that appears to be at the same rotation for all users. This is most useful for slowly rotating objects (e.g. the hands of clock), since universe time is only synchronized to within a few seconds for all users. For faster rotating objects, sync is more useful for synchronizing multiple rotating objects in the same scene to each other (e.g. a series of gears that need to be properly "meshed" together.)

Note that in most cases the "nosync" flag will be desirable with rotate commands linked to the activate trigger. This is because unsynchronized rotates start rotating from the current yaw of the object, whereas synchronized rotates start rotating from a pre-calculated angle based on universe time.

Time

An optional time argument can be specified to control how long the object rotates for. After time seconds elapse, the object stops rotating and stays at its final position. If a time is specified, the nosync flag is implied; timed rotations cannot also be synced.

For timed rotations, given a desired angle to rotate it can sometimes be confusing to figure out what the rpm should be for the rotation. There is actually a simple formula for this:

rpm = a / (6 × t)

Where a is the desired angle, and t is the time to rotate. For example, say a door is desired that rotates 90 degrees in 2 seconds. The rpm for the y-axis would be 90 / (6 × 2) = 90 / 12 = 7.5 rpm.

Loop

The optional loop argument (new in 3.3) is only meaningful if the rotate has a time specified. If loop is specified, the timed rotate will repeat again each time after it completes. noloop is the default.

Loop

The optional reset argument (new in 3.3) is also only meaningful if the rotate has a time specified. If reset is specified, the timed rotate will return immediately to its original position after it completes and the wait period has elapsed. noreset is the default.

Wait

The optional wait argument (new in 3.3) is only meaningful if the rotate has a time specified. It specifies how much time the rotate should pause at the end of its timed rotation before returning to its original position. If loop is specified, the default wait is 0 seconds (i.e. no pause); otherwise, the default wait is infinite.

Name

As with most other commands, you may choose to specify the name of another object to apply the rotation to by using the optional name parameter.

Note that rotate is a special command and as such may not be available for use in all worlds.

Smooth

Normally objects will rotate at a fixed speed. This is acceptable for turning gears and other spinning objects, but it often a bit "stiff" looking when using the rotate command to open doors or perform other rotations that require the object to turn a certain distance and then stop.

The smooth option will cause the object to accelerate as it begins moving, and decelerate as it nears the point where it will stop moving. If you set time=3, the object will still rotate for exactly 3 seconds and will still end up in the excact same position, but its speed while moving will change to make the movement less "jerky".

Note that this option is only meaningful for rotate commands that use the time argument. For commands where time is not specified, smooth will have no effect.

Examples

create rotate 10

This creates an object that rotates around its y-axis 10 times per minute.

    create rotate 4 0 7

This creates an object that rotates 4 times per minute around its x-axis and 7 times per minute around its z-axis.

activate rotate 0 name=sign

This creates an object that when clicked on, cancels any existing rotation on any nearby objects named "sign".

activate rotate 0 0 20 nosync

This creates an object that begins rotating around its z-axis 20 times per minute when clicked on. Since it uses the "activate" trigger, the rotation will only be visible to the user who clicked on the object, and thus has no need to be synchronized. Thus, the nosync option is specified.