Collision Addon

The Collision Add-On will enable you to detect when 2 or more components are touching each other. This mechanism will work regardless if components are fixed, moving or being dragged. If the components are visually touching each other or being overlapped this add-on will detect it.

How to Setup

  1. Open the Store on the left sidebar of the Editor
  2. Search for “Collision”
  3. Drag the Collision addon onto your project to enable it
  4. Add and configure pairs, please continue bellow

Pairs

The Collision Add-On will detect collision between Pairs of components. To define a Pair you should define what components belong to each side of the Pair. Given an example of birds and clouds, on one side of the pair you might be having 2 birds components (they can images components) and in the other side of the Pair you might have floating containers that represent clouds. For each Pair side you should define:

  • Name – The name by which this pair side will be identified.
  • Components which belong to this side of the pair (You can use specific components, tags or even a list components using our components selector ).

Pair triggers

When you create a pair you will also be able to specify which actions you want to run when the Pair is colliding.  This is configured by clicking on the Triggers button in the top bar. 

When pair is colliding

A Pair is said to be colliding if at least 1 component from each side is touching each other. It is also important to notice that the trigger will only execute once per pair collision. This means that if you have 2 birds and 1 cloud. When the 1st bird collides with the cloud the trigger will execute. But when the 2nd bird hits the cloud the trigger will not execute again – because the pair was already colliding. If you want to know exactly which components are colliding with each other you need to specify different pairs.

Pair Data fields

Each Pair will give you numerous data fields which you can use to configure your game mechanisms.

Is the pair colliding (True/False)

Has an up-to-date state of whether the pair is colliding or not.

Number of collisions (Number)

How many total collisions happened in this pair.

Number of components colliding from side 1 (Number)

Tells you how many components are currently colliding from side 1 (i.e birds)

Number of components not colliding from side 1 (Number)

Tells you how many components are currently not colliding from side 1

Components colliding from side 1 (List of Components)

What are the components that are colliding from side 1. You can use this data field together with General Actions

Components not colliding from side 1 (List of Components)

What are the components that are not colliding from side 1. You can use this data field together with General Actions

Number of components colliding from side 2 (Number)

Tells you how many components are currently colliding from side 2 (i.e clouds)

Number of components not colliding from side 2 (Number)

Tells you how many components are currently not colliding from side 2

Components colliding from side 2 (List of Components)

What are the components that are colliding from side 2. You can use this data field together with General Actions

Components not colliding from side 2 (List of Components)

What are the components that are not colliding from side 2. You can use this data field together with General Actions

Pair Actions

Each pair will also give you actions which you can use to control if the add-on should be detecting collisions or not.

Start Pair

Starts detecting collisions among the pair components. All data fields will be updated once this action is executed, until we stop the pair.

Stop Pair

Stops detecting collisions among the pair components. The data fields will not be updated, but they will keep their last value.

Reset Pair

Stops the pair (see above) and also resets the data fields to their initial state. If you want to stop and reset data fields, executing the Reset Pair action is enough.

General actions

The Collision Addon also features actions you can use to control all the Pairs at the same time. These actions are useful if you have many Pairs and you want to control them in the same manner.

Start All

Starts all pairs

Stop All

Stops all pairs

Reset All

Resets all pairs

Updated on March 4, 2021

Was this article helpful?

Related Articles