The interactions between objects, referred to as Collisions in Unreal Engine, lie at the core of any video game experience.
In a game world, the player will always be interacting with collisions. The floor, walls, environment, enemies, objects… almost everything will collide.
Because of this, missing or incorrect collisions can result in noticeable errors, such as characters passing through walls or falling into the ground. Similarly, attempting to jump onto a block and falling through it would undermine the game’s sense of reality. Incorrect collisions frequently result in an odd and unsatisfying experience, which can harm your game.
Collisions can also impact performance and be the root cause of a significant number of bugs. Programmers must handle issues like clipping, ghosting, and sticky collisions. Therefore, collisions are easy to use but difficult to master.
Now, let’s dive into learning how collisions work in Unreal Engine!
Collisions for beginners
For this lesson, I’m going to use an asset called ‘Mossy Forest Boulder‘ from Quixel Bridge. However, you can also follow along with any other Static Mesh you prefer.
If you’ve never used Quixel Bridge before, simply right-click in the Content Browser and select ‘Add Quixel Content‘. Then just search for an asset, download it, and then add it to your Unreal Engine project.
If you are a beginner, I recommend using the Third Person Template for this lesson. This way, you can quickly verify if the collisions are working by moving the player into the static mesh.
As shown in the image below, the rock in this case has no collision, allowing the player to walk through it like a ghost, which is usually not what we want. So let’s create a collision for the boulder!
How to Add Simplified Collision to a Static Mesh?
Step 1: Select the Static Mesh
Find the Static Mesh you want to add a Collision in the Content Browser.
Then double click on it and a new window will open.
Step 2: Add Collision
In the new window, open the Collision Menu.
If you’re a beginner, I recommend starting with basic shapes. To do so, choose one of the following three options:
- Add Sphere Simplified Collision
- Add Capsule Simplified Collision
- Add Box Simplified Collision
Step 3: Modify Collision
In the Details Panel, look for Collision –> Primitives.
Now just open the Spheres, Boxes or Capsules panel, depending on the collisions you created in the previous step. Here you’ll be able to modify their position (center), rotation and size (X, Y, Z Extent).
You can also modify the collision by selecting it and using the standard transform tools: translate, rotate, and scale.
How to use Complex Collisions in Unreal Engine?
To apply a complex collision, just head to Collision -> Collision Complexity in the Details Panel.
Now select “Use Complex Collision as Simple“.
Avoid using this option with a large number of assets, especially if you’re working on a large game, because it will consume significantly more resources than the simplified collision. Exact collisions use more resources.
What is Auto Convex Collision Decomposition?
A third option to create a collision for a Static Mesh is to go to the Collision Menu and select “Auto Convex Collision“.
After choosing this option a new tab called “Convex Decomposition” should appear.
Here you’ll find three parameters:
- Hull Count: Maximum number of convex pieces that will be created.
- Max Hull Verts: Maximum number of vertices allowed for any generated convex hull.
- Hull Precision: Number of voxels to use when generating collision.
Enter the parameters that work for you and click Apply.
Because I had four units in the Hull Count, four convex elements were created for the collision, as shown in the screenshot below.
How to Remove a Collision?
Simply open the Collision Menu and select Remove Collision.
How can I see Collisions in Unreal Engine?
To see Collisions in your game’s main viewport, go to Show -> Collision, or press ALT+C.
If you only want to check the collision within the Static Mesh Editor, go to Show and select Simple Collision, Complex Collision, or both.