There are many objects that can be added to a scene e.g. 3d models, trigger areas, and audio. See below for full documentation of each object.
All objects have some shared properties.
id– A unique id, used to reference the object later.active– Default: true. Only active objects are visible in the scene, and can have events triggered from them.position : [0,0,0]– Set scene objects position to x,y,z.rotation : [0,0,0]– Set scene objects rotation to x,y,z.alpha– Set scene objects opacity. 0 is completely transparent, 255 is completely opaque.on_activate– Event triggers when the active property of an object is set totrue. Also triggers on object creation in active istrue.on_deactivate– Event triggers when the active property of an object is set tofalse.
Table of Contents
- audio
- image
- model
- model_character
- module
- rigid
- state
- text
- trigger_speech
- trigger_ui_button
- trigger_velocity
- trigger_volume_hand, trigger_volume_hand_left, trigger_volume_hand_right
- trigger_volume_head
- trigger_volume_object
audio
Play an audio file.
{
"id": "bg_noise",
"type": "audio",
"path": "audio/bg-music.wav",
"volume": 0.1,
"looping": true
}
path– File path to an aduio file.volume– Volume to play the sound at. From 0 (mute) to 1.looping– Loop the audio when it reaches the end.pitch– Modify the pitch of the audio play back.
image
Display an image in the scene.
{
"type": "image",
"path": "images/instructions-01.jpg",
"position": [-2, 1, 3],
"rotation": [0, 75, 0],
"slice": [40, 20, 40, 30],
"height": 1.2
}
path– File path of an image to display in the scene.slice : [0,0,0,0]– Set the slice values of the image [top, right, bottom, left]width– Width of the image in metres. If omitted, then the width will be calculated from the height, while keeping the correct aspect ratio of the source image.height– Height of the image in metres. If omitted, then the height will be calculated from the width, while keeping the correct aspect ratio of the source image.scale– Scale the object by a scale factor. 1 is default size, 2 is twice default size, 0.5 is half size etc.
model
Display a 3D model in the scene.
{
"id": "city",
"type": "model",
"path": "city/model.um",
"position": [0, -0.5, 15],
"rotation": [0, 90, 0],
"scale": 0.12
},
path– File path to a .um, .uma, or .fbx file.scale– Scale the object by a scale factor. 1 is default size, 2 is twice default size, 0.5 is half size etc.effect– Currently only allows"none"
model_character
Display a 3D character model in the scene.
{
"id": "my_character",
"type": "model_character",
"path": "zane",
"position": [-1, -0.27, -1],
"rotation": [-90, -90, 0]
},
path– File path to a .um, .uma, or .fbx file.scale– Scale the object by a scale factor. 1 is default size, 2 is twice default size, 0.5 is half size etc.effect– Currently allows"none", and"pbr".
module
Load in a seperate JSON file so complex scenes can be split across files, or so specific parts can be reused in multiple scenarios.
{
"id": "street_side",
"type": "module",
"path": "city/static_street.json",
"position": [0, 0, 0],
"rotation": [0, 0, 0]
}
path– File to a .json file containing objects to load as part of the scene.
rigid
An object that is mapped to a PhaseSpace rigid of rigid_id. The objects position and orientation is updated to match the physical prop. A model object can then be attached to the rigid object
{
"id": "box_rigid",
"type": "rigid",
"rigid_id": "10"
}
rigid_id– Id of the PhaseSpace rigid that defined in the config.json.
state
Very minimal object that has no visuals but can be setup to respond to on_activate or on_deactivate.
{
"id": "state_wait_for_flowers",
"type": "state",
"on_activate": [{ "type": "play_animation", "ref": "my_character", "animation": "sit_down" }]
}
text
Show a block of text. The width must be set so the text can be rendered and wrapped correctly.
{
"id": "help_text_1",
"type": "text",
"position": [0, 2, 0],
"rotation": [0, 35, 0],
"width": 1.5,
"text": "Hello Text!\nThis is another line.",
"font_size": 120,
"align": "center",
"color": "#FF0000"
}
text– String of text to display in the 3d world.width– The width of the text area in metres.height– The height of the text area in metres. If omitted, then expand to show all the text.font_size– Size to display the text.align– Default:"left". Text alignment can be set to"left","right","center"color– The color of the text.
trigger_speech
Create a trigger that triggers when it detects one on the phrases being spoken.
{
"id": "trigger_ask",
"type": "trigger_speech",
"public": true,
"phrases": [
"What's your hurry?",
"Why were you going so fast?"
],
"on_speech": [
{ "type": "deactivate" }
]
}
public– Default: true. If public, then a button will be added to the tablet that can fire theon_speechevent of the trigger.phrases– Array on phrases to match to.on_speech– Triggered when speech is detected that matches any of the given phases.
trigger_ui_button
Add a button to the tablet prop, and to the viewer HUD. Pressing the button when cause the on_press event to trigger.
{
"type": "trigger_ui_button",
"text": "Press Me!",
"on_press": [
{"type":"comment", "message":"Button has been pressed!"},
{"type":"deactivate"}
]
}
public– Default: true. If public, then the button will be added to the tablet that can fire theon_pressevent of the trigger.text– Text to display as the button label.on_press– Triggered when the button is pressed on either the tablet, or the viewer HUD.
trigger_velocity
Tracks the ref scene object’s movement, and fires on_over_threshold when its velocity goes over threshold, and on_under__threshold when it goes under.
{
"type": "trigger_velocity",
"ref": "bouquet",
"threshold": 1.0,
"on_over_threshold": [
{"type":"comment", "message":"Moving too fast!"}
],
"on_under_threshold": [
{"type":"comment", "message":"Not moving fast enough!"}
]
}
public– Default: false. If public, then a button will be added to the tablet that can fire theon_over_thresholdevent of the trigger.ref– Reference to the scene object whos velocity will be tracked.threshold– The velocity in metres per second and causes the events to fire.on_over_threshold– Triggered whenrefobject moves faster thanvelocity.on_under_threshold– Triggered whenrefobject moves slower thanvelocity.
trigger_volume_hand, trigger_volume_hand_left, trigger_volume_hand_right
Create a trigger sphere that triggers when your hand enters or leaves the radius. You can make it only trigger with a specific hand by using trigger_volume_hand_left, trigger_volume_hand_right, or either hand by using trigger_volume_hand.
{
"id": "trigger_grab_bouquet",
"type": "trigger_volume_hand",
"public": true,
"position": [1, 2, -1],
"radius": 0.5
}
public– Default: false. If public, then a button will be added to the tablet that can fire theon_enterevent of the trigger.radius– Radius of sphere in meters.on_enter– Triggered when the specified hand enters the volume.on_leave– Triggered when the specified hand leaves the volume.
trigger_volume_head
Create a trigger cylinder that triggers when your head enters or leaves the radius.
{
"id": "trigger_stand_close",
"type": "trigger_volume_head",
"public": true,
"position": [0, 0, 0],
"radius": 1.2
}
public– Default: false. If public, then a button will be added to the tablet that can fire theon_enterevent of the trigger.radius– Radius of cylinder in meterson_enter– Triggered when the head enters the volume.on_leave– Triggered when the head leaves the volume.
trigger_volume_object
Create a trigger sphere that triggers when a specified object enters or leaves the radius.
{
"id": "trigger_flower_pot",
"type": "trigger_volume_object",
"public": true,
"ref": "bouquet",
"position": [0, 1.2, 0],
"rotation": [0, 45, 0],
"radius": 0.1,
"match_rotation": true,
"rotation_threshold": 0.01,
"on_enter": [{"type": "attach", "ref": "bouquet", "target": "trigger_flower_pot"}]
}
public– Default: false. If public, then a button will be added to the tablet that can fire theon_enterevent of the trigger.ref– The objects that triggers the volume object.radius– Radius of sphere in meters.match_rotation– Default: false. If true, then the trigger only fires if the rotation also matches.rotation_threshold– Default: 0.01. Ifmatch_rotationis true, then this sets the tolerance of the matching rotation.on_enter– Triggered when therefobject enters the volume.on_leave– Triggered when therefobject leaves the volume.