# Entity Collision Enabling & Disabling

***

### EntityToggleCollision

This guide provides instructions for setting up the **EntityToggleCollision** action. In the sample app, every time the avatar enters the green trigger area, a notification is sent to the wall and the collider on the wall is toggled on/off. The wall is green when the avatar can pass through and red when the avatar can not pass through.

| <img src="/files/LhA4YV8bGrcSieLZzCAf" alt="" data-size="original">                                      | <img src="/files/8m4Bnh1KNRhcDFsZS4YB" alt="" data-size="original">                                                                                      |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Before the avatar enters the green trigger area, the wall is red and the avatar can not pass through it. | Once the avatar enters the green trigger area, the collider on the wall is toggled to be disabled. The wall is green and the avatar can pass through it. |

In this example, a trigger is created and when the avatar enters the trigger area, an action sends a notification to toggle another object's collider on/off. Any object can be used as a trigger, as long as the object has a collision component. This example uses a 3D box as the trigger area.

#### **An action that toggles an object's collider on/off**

{% stepper %}
{% step %}
**Create the 3D object that will send the notification**

A. Add a 3D object to the scene.

B. The **Collision** component is not required for **EntityToggleCollision** action to work. The **Collision** component is required for the **EntitySubscribeTriggerEnter** trigger that will be used in this example.

C. Click the **Edit Viverse Extension** button.

<figure><img src="/files/FLPh2Pg74oeht0CwDdwb" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add the NotificationCenterPublish action

A. In the VIVERSE extension, select the **TriggerAndAction** plugin for the **Select plugins** dropdown.

B. Add a **Trigger** and select **EntitySubscribeTriggerEnter**.

C. Add **local-player** to the **tags to filter** field.

D. Add an **Action** and select **NotificationCenterPublish**

E. Create a unique notification name and add it to the **notification name to publish** field. In this example, the notification is called **ToggleWall**.

<figure><img src="/files/hLxZNsiqgSnOCw2l5osd" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Create the 3D object that will receive the notification

A. Add a 3D object to the scene.

B. Add a **Collision** component.

C. Add a **Rigidbody** component.

D. Click the **Edit Viverse Extension** button.

<figure><img src="/files/lshIJGGz8DoeEH6DuHSC" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add the EntityToggleCollision action

A. In the VIVERSE extension, select the **TriggerAndAction** plugin for the **Select plugins** dropdown.

B. Add a **Trigger** and select **NotificationCenterSubscribe**.

C. The same text that was added to the **notification name to publish** needs to be added to the **notification name to subscribe**.

D. Add an **Action** and select **EntityToggleCollision.**

<figure><img src="/files/kH7ET3yK4zyxOzFuHcwx" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

## EntityEnableCollision

**Create An Action That Enables An Object's Collider**

This guide provides instructions for setting up the **EntityEnableCollision** action. In the sample app, every time the avatar enters the red trigger area, a notification is sent to the wall object and the collider on the wall object is enabled. The wall is green when the avatar can pass through and red when the avatar can not pass through.

| <img src="/files/KsPRHCpbtdMJGve9iQ4H" alt="" data-size="original">               | <img src="/files/Ld3nWyovcCUzv9Jp4F05" alt="" data-size="original">                                       | <img src="/files/TwEQ9SQKtHjCzJ9mLtPR" alt="" data-size="original">                |
| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| The avatar is able to pass through the wall when the wall’s collider is disabled. | Once the avatar enters the red trigger area, the EntityEnableCollision action enables the wall’s collider | The avatar is unable to pass through the wall once the wall’s collider is enabled. |

In this example, a trigger is created and when the avatar enters the trigger area, an action sends a notification to enable another object's collider. Any object can be used as a trigger, as long as the object has a collision component.&#x20;

{% stepper %}
{% step %}

### Create a trigger area

A. Create a new **3D Box** entity.

B. Add a **Collision** component.

C. Adding a material is optional. A transparent material has been added so that the trigger area is visible in play mode.

D. Click the **Edit Viverse Extension** button.

<figure><img src="/files/BtGdXazdWYwo8Pr3fOCr" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add the **EntitySubscribeTriggerEnter** trigger

A. In the VIVERSE extension, select the **TriggerAndAction** plugin for the **Select plugins** dropdown.

B. Add a **Trigger** and select **EntitySubscribeTriggerEnter**.

C. Add **local-player** to the **tags to filter** field.

E. Add an **Action** and select **NotificationCenterPublish.**

F. Create a unique notification name and add it to the **notification name to publish** field. In this example, the notification is called **EnableWall**.

<figure><img src="/files/7Y7hltDcNYctcPhqq1ak" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Create the object that will have it's collider enabled

A. Create a new **3D Box** entity.

B. Add a **Collision** component.

C. Adding a material is optional. A transparent material has been added so that the trigger area is visible in play mode.

D. Click the **Edit Viverse Extension** button.

<figure><img src="/files/TlGCXd43VamDT0bxwLv3" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add the EntityEnableCollision action

A. In the VIVERSE extension, select the **TriggerAndAction** plugin for the **Select plugins** dropdown.

B. Add a **Trigger** and select **NotificationCenterSusbscribe**.

C. The same text that was added to the **notification name to publish** needs to be added to the **notification name to subscribe**.

D. Add an **Action** and select **EntityEnableCollision.**

<figure><img src="/files/GZohvDK54K2fXBliVtqE" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

## EntityDisableCollision

**Create An Action That Disables An Object's Collider**

This guide provides instructions for setting up the **EntityDisableCollision** action. In the sample app, every time the avatar enters the green trigger area, a notification is sent to the wall object and the collider on the wall object is disabled. The wall is green when the avatar can pass through and red when the avatar can not pass through.

| <img src="/files/5EQL2xKDGWQenuAySw0k" alt="" data-size="original">                | <img src="/files/1FJ2SW0FPlhy5bzplIvg" alt="" data-size="original">                    | <img src="/files/OWvQPbC6Z6CXqEgHpzuS" alt="" data-size="original">               |
| ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| The avatar is unable to pass through the wall when the wall’s collider is enabled. | Once the avatar enters the green trigger area, the action disables the wall’s collider | The avatar is able to pass through the wall when the wall’s collider is disabled. |

In this example, a trigger is created and when the avatar enters the trigger area, an action sends a notification to disable another object's collider. Any object can be used as a trigger, as long as the object has a collision component.&#x20;

{% stepper %}
{% step %}

### Create a trigger area

A. Create a new **3D Box** entity.

B. Add a **Collision** component.

C. Adding a material is optional. A transparent material has been added so that the trigger area is visible in play mode.

D. Click the **Edit Viverse Extension** button.

<figure><img src="/files/PaneXOCMbwKCo5GSWeua" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add the EntitySubscribeTriggerEnter trigger

A. In the VIVERSE extension, select the **TriggerAndAction** plugin for the **Select plugins** dropdown.

B. Add a **Trigger** and select **EntitySubscribeTriggerEnter**.

C. Add **local-player** to the **tags to filter** field.

E. Add an **Action** and select **NotificationCenterPublish.**

F. Create a unique notification name and add it to the **notification name to publish** field. In this example, the notification is called **DisableWall**.

<figure><img src="/files/XeirmndTuQI7j1iYWomY" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Create the object that will have it's collider disabled

A. Create a new **3D Box** entity.

B. Add a **Collision** component.

C. Adding a material is optional. A transparent material has been added so that the trigger area is visible in play mode.

D. Click the **Edit Viverse Extension** button.

<figure><img src="/files/VzTvTZjOVo0bLfSwZH7d" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add the EntityDisableCollision action

A. In the VIVERSE extension, select the **TriggerAndAction** plugin for the **Select plugins** dropdown.

B. Add a **Trigger** and select **NotificationCenterSubscribe**.

C. The same text that was added to the **notification name to publish** needs to be added to the **notification name to subscribe**.

D. Add an **Action** and select **EntityDisableCollision.**

<figure><img src="/files/JDqkQstIyg3x14vF6nxy" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.viverse.com/playcanvas-toolkit/building-with-the-playcanvas-toolkit/no-code-tools/trigger-and-action/entity-collision-enabling-and-disabling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
