Scenario Actions umajinvr

Objects in a scene can trigger various events. You can respond to these events by providing a list of actions that get executed in order. Refer to the Scenario Objects section for what events are available for each object.

The example below shows a car object that starts a looping tween animation when its on_activate event is triggered. All objects have an on_activate event, which is triggered when the active property is set to true. active is true by default for all objects, so the event is triggered as soon as the scene starts.

{ "id": "driving_car", "type": "model", "path": "prius.fbx", "position": [40, 0, 0], "on_activate": [{ "type": "tween", "time": 8000, "looping": true, "properties": { "position": [-40, 0, 0] } }] }

All actions have some shared properties.

Table of Contents

activate

Activate a scene object. Same as calling set with active:true.

{ "type": "activate", "ref": "my_character" }

attach

Attach a scene object to another scene object.

{ "type": "attach", "ref": "bouquet", "target": "my_character", "joint": "right_hand" }

cancel

Cancel a delayed action, including a tween action.

{ "type": "cancel", "ref": "delay_activate_my_character" }

comment

Does nothing functional. Purely for adding a message to your document. Also prints to console if you have access.

{ "type": "comment", "message": "TODO: Make sure this is deactivated." }

deactivate

Deactivate a scene object. Same as calling set with active:false.

{ "type": "deactivate", "ref": "my_character" }

deactivate_all_triggers

Deactivate all trigger objects in the scene.

{ "type": "deactivate_all_triggers }

detach

Detach a scene object from whatever it is currently attached to.

{ "type": "detach", "ref": "bouquet" }

hide_popup

Hide the floating popup.

{ "type": "hide_popup" }

play_animation

Play an animation of a model.

{ "type": "play_animation", "ref": "my_character", "animation": "sit_down", "blend": 400, "looping": false, "on_complete":[] }

play_sound

Play a sound file.

{ "type": "play_sound", "path": "audio/LiftMotor.mp3", "volume": 0.5, "delay": 1000 }

set

Set a property of a scene object.

{ "type": "set", "ref": "my_character", "active": true, "scale": 2.1 }

set_all

Set a property for all scene objects of a given type.

{ "type": "set_all", "object_type": "state", "ignore": ["final_state"], "active": false }

show_popup

Show a floating popup.

{ "type": "show_popup", "path": "try_again.png" }

tween

Tween one or more properties of a scene object.

{ "type": "tween", "ref": "bouquet", "time": 8000, "looping": true, "properties": { "position": [0, 5, 0], "scale": 2 } }

vibrate

Vibrate a controller.

{ "type": "vibrate", "controller": "current", "time": 250 }

particle_start

Activate a particle object in the scene.

{ "type": "particle_start", "delay": 4000, "ref": "particle1" }

particle_stop

Deactivate a particle object in the scene.

{ "type": "particle_stop", "delay": 4000, "ref": "particle1" }