Entity Enabling & Disabling
This document provides several guides that can be used to show and hide objects in a VIVERSE project. These actions can be configured to execute when triggers are activated.
Last updated
This document provides several guides that can be used to show and hide objects in a VIVERSE project. These actions can be configured to execute when triggers are activated.
Last updated
© 2024 HTC CORPORATION
Create An Action That Disables An Object
This guide provides instructions for setting up the EntityDisable action. In the sample app, once the avatar collides with the gold coin, the gold coin is disabled.
The avatar is not colliding with the gold coin.
Once the avatar collides with gold coin, the gold coin is disabled.
In this example, a trigger is created and when triggered, an action disables an object. Any object can be used as a trigger, as long as the object has a Collision component. Because this specific example uses a 3D object that the avatar and other objects can collide with, a RigidBody component needs to be added. In this example, the object golden_coin is used, but a simple cube will suffice.
A. Click the "Add Component" button. Select Physics > Collision to add a Collision component. Click the "Add Component" button again and select Physics > Rigid Body to add the RigidBody component.
B. In this example, the golden_coin has a Mesh collider that encompasses the entire object by default. Resize the collider here if the collider's size needs to be changed.
C. Click the "EDIT VIVERSE EXTENSION" button to add the VIVERSE functionality.
A. Click the Select plugins text field and select TriggerAndAction in the dropdown menu.
B. Click "+" beside the Select a module and add dropdown.
C. Click "+" beside the selected module dropdown.
D. Click the type dropdown and select a desired trigger. In this example the EntitySubscribeCollisionStart trigger is selected.
E. Click "+" beside the selected module dropdown.
F. Click the type dropdown and select EntityDisable action in the dropdown menu.
Create An Action That Enables A Single Object
This guide provides instructions for setting up the EntityEnableById action. In the sample app, once the avatar enters the trigger area, the gold coin is enabled.
When the avatar is outside of the blue trigger area, the gold coin is disabled.
When the avatar enters the blue trigger area, the gold coin is enabled.
In this example, a trigger is created and when triggered, an action enables an object. Any object can be used as a trigger, as long as the object has a Collision component. Because this specific example creates an empty area that the avatar and other objects can pass through, a simple entity with a box shape is used instead of a 3D object. The entity does not have a RigidBody component added. Right-click in the Hierarchy and select New Entity > Entity.
A. Click the "Add Component" button. Select Physics > Collision to add a Collision component.
B. Resize the collider to the desired size. In this example, the Half Extents field has been set to (2.5, .5, 2.5) for X, Y, Z.
C. The entity itself is currently set to Position (0, 0, 0) for X, Y, Z. In this example, the values for Position Offset are set to (0, -2, 0) for X, Y, Z to lower the collider to the ground.
D. Click the "EDIT VIVERSE EXTENSION" button to add the VIVERSE functionality.
A. Click the Select plugins text field and select TriggerAndAction in the dropdown menu.
B. Click "+" beside the Select a module and add dropdown.
C. Click "+" beside the selected module dropdown.
D. Click the type dropdown and select a desired trigger. In this example, the EntitySubscribeTriggerEnter trigger is selected.
E. Click "+" beside the selected module dropdown.
F. Click the type dropdown and select EntityEnableById action in the dropdown menu. For the EntityEnableById action to work, an object needs to be added that will be enabled. In this example, the golden_coin object is added.
Create An Action That Disables A Single Object
This guide provides instructions for setting up the EntityDisableById action. In the sample app, once the avatar leaves the trigger area, the gold coin is disabled.
When the avatar is inside the blue the trigger area, the gold coin is enabled.
When the avatar leaves the blue trigger area, the gold coin is disabled.
In this example, a trigger is created and when triggered, an action disables an object. Any object can be used as a trigger, as long as the object has a Collision component. Because this specific example creates an empty area that the avatar and other objects can pass through, a simple entity with a box shape is used instead of a 3D object. The entity does not have a RigidBody component added. Right-click in the Hierarchy and select New Entity > Entity.
A. Click the "Add Component" button. Select Physics > Collision to add a Collision component.
B. Resize the collider to the desired size. In this example, the Half Extents field has been set to (2.5, .5, 2.5) for X, Y, Z.
C. The entity itself is currently set to Position (0, 0, 0) for X, Y, Z. In this example, the values for Position Offset are set to (0, -2, 0) for X, Y, Z to lower the collider to the ground.
D. Click the "EDIT VIVERSE EXTENSION" button to add the VIVERSE functionality.
A. Click the Select plugins text field and select TriggerAndAction in the dropdown menu.
B. Click "+" beside the Select a module and add dropdown.
C. Click "+" beside the selected module dropdown.
D. Click the type dropdown and select a desired trigger. In this example, the EntitySubscribeTriggerLeave trigger is selected.
E. Click "+" beside the selected module dropdown.
F. Click the type dropdown and select EntityDisableById action in the dropdown menu. For the EntityDisableById action to work, an object needs to be added that will be disabled. In this example, the golden_coin object is added.
Create An Action That Enables Multiple Objects
This guide provides instructions for setting up the EntityEnableByTag action. In the sample app, once the avatar enters the trigger area, multiple balls are enabled.
When the avatar is outside the blue trigger area, the balls are disabled.
When the avatar enters the blue trigger area, the balls are enabled.
In this example, a trigger is created and when triggered, an action enables multiple objects. Any object can be used a trigger, as long as the object has a Collision component. Because this specific example creates an empty area that the avatar and other objects can pass through, a simple entity with a box shape is used instead of a 3D object. The entity does not have a RigidBody component. Right-click in the Hierarchy and select New Entity > Entity.
A. Add the tag local-player to the Tags field.
B. Click the "Add Component" button. Select Physics > Collision to add a Collision component.
C. Resize the collider to the desired size. In this example, the Half Extents field has been set to (2.5, .5, 2.5) for X, Y, Z.
D. The entity itself is currently set to Position (0, 0, 0) for X, Y, Z. In this example, the values for Position Offset are set to (0, -2, 0) for X, Y, Z to lower the collider to the ground.
E. Click the "EDIT VIVERSE EXTENSION" button to add the VIVERSE functionality.
A. Click the Select plugins text field and select TriggerAndAction in the dropdown menu.
B. Click "+" beside the Select a module and add dropdown.
C. Click "+" beside the selected module dropdown.
D. Click the type dropdown and select a desired trigger. In this example, the EntitySubscribeTriggerEnter trigger is selected.
E. Click the tags to filter text field and add local-player tag.
F. Click "+" beside the selected module dropdown.
G. Click the type dropdown and select EntityEnableByTag action in the dropdown menu. For the EntityEnableByTag action to work, a Tag needs to be added. In this example, the Balls tag is created and added.
Create An Action That Disables Multiple Objects
This guide provides instructions for setting up the EntityDisableByTag action. In the sample app, once the avatar leaves the trigger area, multiple balls are disabled.
When the avatar enters the blue trigger area, the balls are enabled.
When the avatar leaves the blue trigger area, the balls are disabled.
In this example, a trigger is created and when triggered, an action disables multiple objects. Any object can be used as a trigger, as long as the object has a Collision component. Because this specific example creates an empty area that the avatar and other objects can pass through, a simple entity with a box shape is used instead of a 3D object. The entity does not have a RigidBody component. Right-click in the Hierarchy and select New Entity > Entity.
A. Add the tag local-player to the Tags field.
B. Click the "Add Component" button. Select Physics > Collision to add a Collision component.
C. Resize the collider to the desired size. In this example, the Half Extents field has been set to (2.5, .5, 2.5) for X, Y, Z.
D. The entity itself is currently set to Position (0, 0, 0) for X, Y, Z. In this example, the values for Position Offset are set to (0, -2, 0) for X, Y, Z to lower the collider to the ground.
E. Click the "EDIT VIVERSE EXTENSION" button to add the VIVERSE functionality.
A. Click the Select plugins text field and select TriggerAndAction in the dropdown menu.
B. Click "+" beside the Select a module and add dropdown.
C. Click "+" beside the selected module dropdown.
D. Click the type dropdown and select a desired trigger. In this example, the EntitySubscribeTriggerLeave trigger is selected.
E. Click the tags to filter text field and add local-player tag.
F. Click "+" beside the selected module dropdown.
G. Click the type dropdown and select EntityDisableByTag action in the dropdown menu. For the EntityDisableByTag action to work, a Tag needs to be added. In this example, the Balls tag is created and added.
Create An Action That Fades In An Object
This guide provides instructions for setting up the EntityFadeIn action. In the sample app, once the avatar starts colliding with the red platform, the red platform will fade in.
The red platform has been faded out and is invisible, but the avatar can still collide with it.
Once the avatar begins colliding with the invisible red platform, the red platform fades in and is now visible.
In this example, a trigger is created and when triggered, an action fades in the object it has been added to. Any object can be used as a trigger, as long as the object has a Collision component. Because this specific example uses a flattened 3D Cube that the avatar collides with, a RigidBody component needs to be added. Right-click in the Hierarchy and select New Entity > 3D > Box.
A. In this example, the cube has been flattened by setting the values for Scale to (2, .1, 2) for X, Y, Z.
B. Click the "Add Component" button. Select Physics > Collision to add a Collision component. Click the "Add Component" button again and select Physics > Rigid Body to add the RigidBody component.
C. Resize the collider to the desired size. In this example, the Half Extents field has been set to (.5, .05, .5) for X, Y, Z.
D. Click the "EDIT VIVERSE EXTENSION" button to add the VIVERSE functionality.
A. Click the Select plugins text field and select TriggerAndAction in the dropdown menu.
B. Click "+" beside the Select a module and add dropdown.
C. Click "+" beside the selected module dropdown.
D. Click the type dropdown and select a desired trigger. In this example, the EntitySubscribeCollisionStart trigger is selected.
E. Click "+" beside the selected module dropdown.
F. Click the type dropdown and select EntityFadeIn action in the dropdown menu. In this example, a delay of 1000 milliseconds (1 second) has been added before the fade in begins and a duration of 3000 millisecond (3 seconds) has been designated for how long the fade in should last.
EntityFadeOut - Create An Action That Fades Out An Object
This guide provides instructions for setting up the EntityFadeOut action. In the sample app, once the avatar stops colliding with the red platform, the red platform will fade out.
The avatar is colliding with the red platform.
Once the avatar stops colliding with the red platform, the red platform begins to fade out.
In this example, a trigger is created and when triggered, an action fades an object. Any object can be used as a trigger, as long as the object has a Collision component. Because this specific example uses a flattened 3D Cube that the avatar collides with, a RigidBody component needs to be added. Right-click in the Hierarchy and select New Entity > 3D > Box.
A. In this example, the cube has been flattened by setting the values for Scale to (2, .1, 2) for X, Y, Z.
B. Click the "Add Component" button. Select Physics > Collision to add a Collision component. Click the "Add Component" button again and select Physics > Rigid Body to add the RigidBody component.
C. Resize the collider to the desired size. In this example, the Half Extents field has been set to (.5, .05, .5) for X, Y, Z.
D. Click the "EDIT VIVERSE EXTENSION" button to add the VIVERSE functionality.
A. Click the Select plugins text field and select TriggerAndAction in the dropdown menu.
B. Click "+" beside the Select a module and add dropdown.
C. Click "+" beside the selected module dropdown.
D. Click the type dropdown and select a desired trigger. In this example, the EntitySubscribeCollisionEnd trigger is selected.
E. Click "+" beside the selected module dropdown.
F. Click the type dropdown and select EntityFadeOut action in the dropdown menu. In this example, a delay of 1000 milliseconds (1 second) has been added before the fade out begins and a duration of 3000 milliseconds (3 seconds) has been designated for how long the fade out should last.
Create An Action That Toggles An Object's Enabled State
This guide provides instructions for setting up the EntityToggleEnabled action. In the sample app, every time the avatar enters the blue trigger area, a notification is sent to the purple box to toggle it’s enabled state.
The purple box is enabled/visible before the avatar enters the blue trigger area.
Once the avatar enters the blue trigger area, a notification is sent to the purple box to toggle it’s enabled stated. The purple box is disabled.
The avatar leaves the blue trigger area.
Once the avatar enters the blue trigger area, a notification is sent to the purple box to toggle it’s enabled stated. The purple box is enabled again.
In this example, a trigger is created and when the avatar or other objects enter the trigger area, an action sends a notification to toggle another object's enabled state. Any object can be used as a trigger, as long as the object has a Collision component. Because this specific example creates an empty area that the avatar and other objects can pass through, a simple 3D box is used. The entity does not have a RigidBody component added. Right-click in the Hierarchy and select New Entity > 3D > Box.
A. Click the "Add Component" button. Select Physics > Collision to add a Collision component.
B. Resize the collider to the desired size. In this example, the Half Extents field has been set to (2.5, .5, 2.5) for X, Y, Z.
C. Click the "EDIT VIVERSE EXTENSION" button to add the VIVERSE functionality.
A. Click the Select plugins text field and select TriggerAndAction in the dropdown menu.
B. Click "+" beside the Select a module and add dropdown.
C. Click "+" beside the selected module dropdown.
D. Click the type dropdown and select a desired trigger. In this example, the EntitySubscribeTriggerEnter trigger is selected.
E. Click "+" beside the selected module dropdown.
F. Click the type dropdown and select NotificationCenterPublish action in the dropdown menu.
G. Add a name for this notification in the notification name to publish field. In this example, the Toggle name is added. All of the objects that subscribe to the Toggle notification will receive notification.
A. In this example, the object receiving the notification is a simple 3D cube. Any object can be used to receive notifications. Right-click in the Hierarchy and select New Entity > 3D > Box. Click the "EDIT VIVERSE EXTENSION" button to add the VIVERSE functionality.
A. Click the Select plugins text field and select TriggerAndAction in the dropdown menu.
B. Click "+" beside the Select a module and add dropdown.
C. Click "+" beside the selected module dropdown.
D. Click the type dropdown and select a trigger. In this example, the NotificationCenterSubscribe trigger selected.
E. In the notification name to subscribe field, add the same name that was used in the NotificationCenterPublish action. In this example, the Toggle name is added. This object will receive notifications from objects that publish to the Toggle notification name.
F. Click "+" beside the selected module dropdown.
G. Click the type dropdown and select a desired action. In this example, the EntityToggleEnabled action is selected.