Colliders
This page will go into Colliders and how to best use them in your space
Colliders video Tutorial
Colliders are used in Unity to make sure the player doesn't run or fall through your environment. Colliders are also used for other functionality, such as what the user can 'see' as the Canvas, Artifact, or Portal. Colliders are referred to as Bounding Boxes as well.
There are 4 main types of Collider in Unity :
- Box Collider
- Sphere Collider
- Capsule Collider
- Mesh Collider
Applying a collider is as simple as adding the component to your object and modifying it as you need in order to cover the area you require. You can type in the Search bar to find it faster (box, sphere, capsule, or mesh) or 'collider'. It is also possible to add a collider to an empty game object, this may be useful if you want to create an object that has all the wall colliders in one place.

Adding a box collider to the Cube
These colliders are the most common as they are the most performant. Use Box Colliders where you can as this doesn't cost nearly as much on performance as things like a mesh collider.

Box, Sphere, and Capsule Collider examples.
A mesh collider allows your to create custom meshes as the collider. These are not nearly as performant as the basic Colliders and should be used sparingly.
DO NOT put a Mesh collider on a high polygon object.
Using a Mesh collider on a high polygon object will slow down the space considerably. If you have to use a mesh collider for an asset in your space, then you should create an optimised mesh to be used for the collider. Design the optimised mesh with the basic shape in mind, and cut down the polygons as much as possible.

High polygon and low polygon examples
It is possible to make stairs work more like a ramp shown in the example above. Not only does this improve performance, but makes a smoother user experience as well especially for larger step heights.
Make sure that the position and scale of the object and mesh collider line up in the Asset creation tool (such as Blender or Maya). This is not compulsory, but it makes lining things up much easier. The example image above with separated objects is not how they objects should be laid out.
To add a custom object as a mesh collider, make sure to use the child mesh object on the imported model. This can be found under the asset itself in the Project window. It should have a grid icon next to it. The Model itself cannot be used in the mesh collider slot.

Adding the Mesh of the Model to the Mesh collider
Mona uses Colliders in a variety of ways for different asset types.
Portals require a box collider (other colliders also work but is not recommended) on the 'Portal' tagged object in order to function correctly in Mona. This is used so that the user can 'see' the portal, and therefore interact with it. This collider will also be a physical collider.
Make sure that there are no colliders in front of the Portal tagged object Collider. If there is a collider in front of it, the user will not be able to see it, making the portal only work as an entrance to the space.
Objects tagged with 'Canvas' must have a mesh collider applied. No other collider works in this case. This collider will also be a physical collider.
Objects tagged with 'Artifact' can have a Box Collider (recommended) or other collider applied. This collider will also be a physical collider.
Make sure that there are no other colliders in front of the Artifact or Canvas tagged object Collider. If there is a collider in front of it, the user will not be able to see or interact with it.
As Reactor uses colliders for events (such as OnEnterCollider, OnExitCollider, OnInteract, OnLookAt, and OnLookAway) it is important to make sure that the colliders are used correctly.
These are not necessarily the same functionality as Colliders to stop a user from walking into something, but some of the settings require the collider to be a physical collider (such as OnInteract) whereas others are able to be walked through (such as OnEnterTrigger and OnExitTrigger).
These settings will be covered more in the Reactor docs. The 'IsTrigger' is an item in the collider component and defines what kind of collider it is. As a quick summary :
- OnEnterTrigger / OnExitTrigger - IsTrigger is On. Can be walked through.
- OnLookAt / OnLookAway - IsTrigger is On. Can be walked through.
- OnInteract - IsTrigger can be On or Off, so it can be a physical collider or not.
A common issue is having a collider overlap other colliders, such as a OnEnterTrigger collider overlapping an OnInteract collider. This situation will block the user being able to see the OnInteract collider, so keep this in mind if you are having issues with colliders.
Last modified 25d ago