35 Interaction
#todo
interface ArtifactAttachments {
interaction: InteractionAttachment[], // OPTIONAL
// ...
}
interface InteractionAttachment {
name: string; // REQUIRED must be unique in artifact
cues?: string[]; // OPTIONAL
play: InteractionPlay; // REQUIRED
}
interface InteractionPlay {
js: string // OPTIONAL
system: string // OPTIONAL
// ...
}
interface InteractionIndex {
artifactId: string // OPTIONAL
interactionName: string; // REQUIRED
} // for other module to refrance a interaction.
Interactions are functions invoked by the interface that run on the client side and modify the space through the trace.
The interaction function can run in three cases:
-
On asset load Triggered once when the corresponding asset is loaded into the space. It can only change the corresponding model’s animation, and the interaction must specify the animation name.
-
On interface call Triggered by the interface, for example on mouse click or hover, or through avatar actions and positions.
-
On space load Triggered when the space itself is loaded. It can only change a predefined list of visual properties of the space.
The interaction function, once called, can modify the following:
-
Trace or Subtrace Add the corresponding history
Storyor modifyStateforTraceandSubtrace.Storyentries in aSubtraceare typically more detailed. -
Run-time loading Add a new entry to
StateinSubtracewith a new address to temporarily load an asset, where theextrafield is anEmbeddingobject. Such assets remain in the space only during the current run-time, while the interaction function is active, or up to 10 minutes if the asset is not in the user’s inventory. -
Interface Modify the interface, for example by showing a pop-up window, playing a model animation, or playing a specific music track.
-
Other interactions Call other interaction functions. A chain of interactions can run for a maximum of 10 minutes in total.