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.
look_at
- Rotate the scene object to always face the object with the given id. Can use "@player_head"
so the object always faces the user.
on_activate
- Event triggers when the active property of an object is set to true
. Also triggers on object creation in active is true
.
on_deactivate
- Event triggers when the active property of an object is set to false
.
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.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.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"
Display a 3D character model in the scene.
{
"id": "my_character",
"type": "model_character",
"path": "characters/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"
.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.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 attach
ed 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.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" }]
}
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.Create a particle visual effect using an image file.
{
{
"id": "particle1",
"type": "particle",
"path": "particle1.png",
"position": [-0.42, 0.75, 1.56],
"rotation": [0, 0, 0],
"scale": 0.2,
"effect" : "none",
"quantity" : 200,
"init_min_alpha" : 30,
"init_max_alpha" : 50,
"init_min_life" : 60,
"init_max_life" : 120,
"init_min_py_vel" : 0.9,
"init_max_py_vel" : 1.1,
"init_min_px_vel" : -0.5,
"init_max_px_vel" : 0.5,
"gravity" : -0.01,
"particle_rate" : 0.5,
"look_at": "@player_head",
}
}
effect
- Shader supports 'pbr', 'pbr_fog' and 'basic_no_normal'quantity
- Number of particles that are created before ending.init_min_alpha
- Lowest transparency value for each particle.init_max_alpha
- Highest transparency value for each particle.init_mix_life | init_max_life
- Lifespan of each particle.init_min_py_vel | init_max_py_vel
- Velocity of the particle along the y axis.init_min_px_vel | init_max_px_vel
- Velocity of the particle along the x axis.init_min_pangle | init_max_pangle
- Min and max values for the angle of the particle.particle_rate
- Speed in which new particles are formed.look_at
- Tracks the position of the users head so that the partcle always face them.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 the on_speech
event of the trigger.
phrases
- Array on phrases to match to.
on_speech
- Triggered when speech is detected that matches any of the given phases.
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 the on_press
event 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.
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 the on_over_threshold
event 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 when ref
object moves faster than velocity
.
on_under_threshold
- Triggered when ref
object moves slower than velocity
.
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 the on_enter
event 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.
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 the on_enter
event of the trigger.
radius
- Radius of cylinder in meters
on_enter
- Triggered when the head enters the volume.
on_leave
- Triggered when the head leaves the volume.
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 the on_enter
event 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. If match_rotation
is true, then this sets the tolerance of the matching rotation.
on_enter
- Triggered when the ref
object enters the volume.
on_leave
- Triggered when the ref
object leaves the volume.