Rotate

From DeltaWiki
Revision as of 00:14, 5 May 2023 by Xan (talk | contribs) (Created page with "{{feature|N/A|3.1}} 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. ==Usage== '''rotate''' [''x''] ''y'' [''z''] [pivot=''"x y z"''] [sync OR nosync] [loop OR noloop] [reset OR noreset] [time=''time''] [wait=''wait''] [name=''na...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Rotate
Build

N/A

Version

3.1

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.

Usage

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

x y z

The x y z arguments are three number values that specify the rounds-per-minute spin on tilt, yaw and roll respectively. Each value is clamped to a range of -50000 to 50000. The y and z values can be omitted to only spin the object along the y axis. Likewise, the z value can be omitted to only move the object along the x and y axis.

pivot

Introduced in version 6.6.0.1607
Caution the pivot axes appear at build location, the model itself appears at the pivot offset location!

The x y z arguments to the pivot option are three number values that specify the geometry offset of the pivot, the point the model will rotate around. The given values are in meters and are added to an eventually already defined pivot within the geometry. The limits for the x y z arguments are +/- 20.0 meters each and all 3 arguments must be supplied.

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

Introduced in version 3.3

The optional loop argument 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.

wait

Introduced in version 3.3

The optional wait argument 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.

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 exact 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.

global

A command with the Global argument appended will cause the object to rotate globally for all users who have the object in view. Without the Global parameter, the object will rotate exclusively for the person who activates the trigger (bump, activate, adone).

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.

create rotate 10 2 5 pivot="4 0 0", move 2 loop smooth

A funny fly path with a pivot offset.

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.

Object Scripting

Building2.jpg

Triggers: CreateBumpActivateAdoneAtCollideSdoneEnter ZoneExit Zone

Commands: AddforceAddtorqueAlpharefAnimateAstartAstopCameraColliderColltagColorCoronaEnviExamineFrameGroupLightLinkLockMatfxMediaMidiMoveNameNoiseOpacityPictureRotateSayScale SeqShadowShearSignSkewSkyboxSolidSoundTagTeleport / TeleportxTextureTimerURLVelocityVisibleWarpWeb nl:Commando:Rotate