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.
- type– The type of action to trigger. Look before for docs on all the various types of actions.
- delay– Delay the action for a given time in milliseconds.
- id– (Optional) Used to reference the action later. Mostly used for canceling a delayed action.
Table of Contents
- activate
- attach
- cancel
- comment
- deactivate
- deactivate_all_triggers
- detach
- hide_popup
- play_animation
- set
- set_all
- show_popup
- tween
- vibrate
activate
Activate a scene object. Same as calling set with active:true.
{ "type": "activate", "ref": "my_character" }
- ref– Reference to a scene object. Can be an array of objects, to set multiple at once. If omitted, then- thisis used.
attach
Attach a scene object to another scene object.
{
	"type": "attach",
	"ref": "bouquet",
	"target": "my_character",
	"joint": "right_hand"
}
- ref– Reference to the scene object that will be attached. If omitted, then- thisis used.
- target– Reference to the scene object that- refwill be attached to.
- joint– Joint name to attach to. If- targetis a- model_character, then you must set the name of the joint.
cancel
Cancel a delayed action, including a tween action.
{ "type": "cancel", "ref": "delay_activate_my_character" }
- ref– Reference to the delayed action that will be cancelled. The action must be given an- idto be referenced.
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" }
- ref– Reference to a scene object. Can be an array of objects, to set multiple at once. If omitted, then- thisis used.
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" }
- ref– Reference to the scene object that will be detached. If omitted, then- thisis used.
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":[]
}
- ref– Reference to either a- modelor a- model_characterscene object. If omitted, then- thisis used.
- animation– The name of the animation to play on the model.
- blend– Blend time in milliseconds.
- looping– Loop the animation when it reaches the end.
- on_complete– Triggered when animation reaches the end.
set
Set a property of a scene object.
{
	"type": "set",
	"ref": "my_character",
	"active": true,
	"scale": 2.1
}
- ref– Reference to a scene object. Can be an array of objects, to set multiple at once. If omitted, then- thisis used.
- active : true,false– Activate or deactivate scene object.
- position : [0,0,0]– Set scene objects position to x,y,z.
- rotation : [0,0,0]– Set scene objects rotation to x,y,z.
- All other arguments are the properties and values to set.
set_all
Set a property for all scene objects of a given type.
{
	"type": "set_all",
	"object_type": "state",
	"ignore": ["final_state"],
	"active": false
}
- object_type– The name of the type of objects to set the properties for.
- ignore– A list of object IDs to ignore when setting the properties.
- All other arguments are the properties and values to set.
show_popup
Show a floating popup.
{ "type": "show_popup", "path": "try_again.png" }
- path– File path to an image to show as a popup.
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
	}
}
- ref– Reference to the scene object that will be attached. If omitted, then- thisis used.
- time– The duration of the tween in milliseconds.
- looping– Loop the tween when it reaches the end.
- properties– An object with all the properties and values that will be tweened. Properties can be any anything that the- setaction can set.
vibrate
Vibrate a controller.
{ "type": "vibrate", "controller": "current", "time": 250 }
- controller– What controller to vibrate. Can be- left,- rightor- current.- currentcan be used when in a triggers event, and will use what ever controller triggered the event.
- axis–
- time– Amount of time in milliseconds to vibrate for. Default is 100 milliseconds.