Actions make it easy to add simple interactivity to your experience without having to write any code.
Here are some examples of what you can achieve using actions:
- Launching a website when the user taps a button
- Switching between different UIs using a menu of buttons
- Playing timeline animations
- Changing content when the user no longer sees a tracking image
This article should get you up to speed with actions in no time.
Adding an Action
Actions can be added to certain nodes from the Actions tab within the Properties panel with the node selected in the Hierarchy.
First, the event is selected followed by the action to perform when that event is fired by the node.
The action will then appear along with a set of options relating to that action.
The example below shows adding a 'Play Timeline' action when the user taps on the plane node on their device:
Nodes with actions can be identified in the Hierarchy by the icon after their name.
The events available to a node are contextual and vary depending on the node type and the options presented are contextual to the action selected. The following sections will cover the various events and actions.
The following table lists the events available to each node type, along with a description of the event itself.
|Accelerometer||Landscape||The device is in the default landscape orientation.|
|-||Landscape Inverted||The device is in an inverted landscape orientation.|
|-||Portrait||The device is in portrait orientation.|
|-||Portrait Inverted||The device is in an inverted portrait orientation.|
|Audio||Finish||The audio has finished playing.|
|Face Group / Face Paint||On Seen||A face is detected in the camera feed.|
|-||On First Seen||A face is first detected in the camera feed.|
|-||On Not Seen||A face is not detected in the camera feed.|
|-||On Mouth Open||The current face instance's mouth is open.|
|-||On Mouth Close||The current face instance's mouth is closed.|
|-||On Left Eye Open||The current face instance's left eye is open.|
|-||On Left Eye Close||The current face instance's left eye is closed.|
|-||On Right Eye Open||The current face instance's right eye is open.|
|-||On Right Eye Close||The current face instance's right eye is closed.|
|Headset Manager||Headset Mode Enter||The device has entered headset mode.|
|-||Headset Mode Leave||The device has exited headset mode.|
|-||Headset Button Press||The button has been pressed, while in headset mode.|
|Object||Tap||The object has been tapped.|
|-||Trigger Region Enter||The origin point of the object first enters a TriggerRegion.|
|-||Trigger Region Leave||The origin point of the object leaves a TriggerRegion.|
|Raycaster||IntersectionEnter||The raycaster has intersected with an object.|
|-||Intersection Leave||The raycaster is no longer intersecting with the object it had been previously.|
|Root||Show||The root node is currently visible.|
|-||Hide||The root node is currently hidden.|
|Target / ZapBox Map / ZapBox Controller||Seen||The target image is detected in the camera feed.|
|-||First Seen||The target image is first detected in the camera feed.|
|-||Not Seen||The target image is not detected in the camera feed.|
|Trigger Region||Trigger Enter||The origin point of an object first enters the TriggerRegion.|
|-||Trigger Region Leave||The origin point of an object leaves the TriggerRegion.|
|Video||Playing||The video has begun playback.|
|-||Pause||The video has been paused.|
|-||Finish||The video has finished playing.|
|-||Buffering||The video is buffering and needs to download more data before continuing.|
|-||Error||There is an issue with video playback.|
|Video Texture||Finish||The video has finished playing.|
The following table lists the actions available for all events, along with a description of what the action does and the options provided.
|Launch Web Link||Launches a URL, with the option to launch it in an external browser.|
|Vibrate||Vibrates the user's device (if the device's vibration functionality is enabled).|
|Activate State||Activates a state from a controller.|
|Play Timeline||Plays a timeline.|
|Stop Timeline||Stops a timeline.|
|Play Fullscreen Video||Plays a video in full screen, using the device's default video player.|
|Take Snapshot||Takes a snapshot of the current camera feed, with the option to save or share the resulting image.|
|Use Front Facing Camera||Sets the front facing camera as active in the camera feed.|
|Use Back Facing Camera||Sets the back facing camera as active in the camera feed.|
|Enter Headset Mode||Requests the device to enter headset mode for use in ZapBox and other cardboard headsets.|
The next article introduces Scripts - the advanced way of incorporating interaction into experiences.
Next article: Face Tracking