Work with Sequence Nodes
Using Lua to interact with Sequence nodes
Sequences are animations that can be controlled from scripts.
Properties
Property | Type | Description |
---|
Enabled | boolean | Playing or not |
Position | number | Current time in seconds the sequence is set to |
Length | number | Total length of the sequence in seconds - dynamically derived from all tracks |
PlayMode | number | Play direction, __Sequence_PlayForwards (0), or __Sequence_PlayBackwards (1) |
PlayCount | number | Number of times to play sequence, if less than 0, it loops forever |
PlaySpeed | number | Scalar value to apply to the timestep value when playing - 1.0 normal speed, 0.5 half speed, 2.0 double speed, etc |
PlayUser | vrnode | The user triggering the sequence playback (when playing a sequence with a body track this dictates which user flies in a collaborative session) |
Example
This script prints the length and play speed of a sequence to the Log window and the sets the sequence to play forever and starts the sequence playing.
-- Drag/Drop section BEGINS - Do not edit between BEGINS and ENDS.
local Sequence = __Script.dragdrop.Sequence
-- Drag/Drop section ENDS
print("Length = ", Sequence.Length)
print("Speed = ", Sequence.PlaySpeed)
-- set the sequence to play forwards
Sequence.PlayMode = 0
-- set the sequence to play forever
Sequence.PlayCount = -1
-- set the sequence to play
Sequence.Enabled = 1