viverse logo

EntityEnableById

EntityEnableById - 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.

1 2
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.

1. 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.

3

2. To add the EntityEnableById 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 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.

4

Previous

EntitySubscribeCollisionEnd

Next

EntityDisableById