Links

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' such as the Canvas, Artifact, or Portal. Colliders are referred to as Bounding Boxes as well.
There are four main types of Collider in Unity :
  • Box Collider
  • Sphere Collider
  • Capsule Collider
  • Mesh Collider

Adding a Collider to an Object

  • Applying a collider is as simple as adding the component to your object and modifying it to cover the required area. You can type in the Search bar to find it faster (box, sphere, capsule, or mesh) or 'collider.'
  • It is possible to add a collider to an empty game object, and this may be useful if you want to create an object with all the wall colliders in one place, or rotate colliders as the base component does not have rotation.
Adding a box collider to the Cube

Box, Sphere, and Capsule Colliders

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 a mesh collider.
Box, Sphere, and Capsule Collider examples.

Mesh Colliders

A mesh collider allows you 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.
A Mesh collider on a high polygon object will affect how well the space runs. If you have to use a mesh collider for an asset in your space, then you should create an optimized mesh for the collider. Design the optimized 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 it makes a smoother user experience as well, especially for larger step heights.

Adding a Custom Mesh Collider

  • Ensure the object's position, scale, and mesh collider line up in the Asset Creation tool (such as Blender or Maya). This makes lining things up much easier. The example image above with separated objects is not how the 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
For more information on Mesh Colliders, check out the Unity Documentation here.

Colliders on Mona Assets

Mona uses Colliders in a variety of ways for different asset types.

Portals

Portals require a box collider (other colliders also work but are not recommended) on the 'Portal' tagged object to function correctly in Mona. This is used so the user can 'see' the portal and interact with it. This collider will also be a physical collider.
Ensure there are no colliders in front of the Portal tagged object Collider. If there is a collider in front of it, the user cannot see it, making the portal only work as an entrance to the space.

Artifacts & Canvases

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.
Ensure 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 cannot see or interact with it.

Using Colliders with Reactor

Reactor uses Collider events (such as OnEnterCollider, OnExitCollider, OnInteract, OnLookAt, and OnLookAway), ensuring the Colliders are used correctly is important.
These are not 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 can be walked through (such as OnEnterTrigger and OnExitTrigger).
These settings will be covered more in Mona Reactor.
A common issue is having a collider overlap other colliders, such as an OnEnterTrigger collider overlapping an OnInteract collider. This situation will block the user from seeing the OnInteract collider, so keep this in mind if you are having issues with colliders.