EntityDisableByTag - 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. |
1. 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.
2. To add the EntityDisableByTag action 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.
3. Multiple objects can be disabled by adding the Tag that was created in the previous step.
A. Click the Tags text field and add the Balls tag to multiple objects or parents of multiple objects.