In Unreal Engine 4, we will be able to autogenerate collisions for our meshes that can be used in our game. There are two different types of collision that exist in Unreal Engine 4: simple and complex collision. Each type of collision serves its own unique purpose, and in this section, we will simply define each collision type and provide examples of each. Later on in this chapter, we will work on how to apply these collisions to our objects. We will also test these collisions in our game. Let's begin with simple collision.
A simple collision is a collision mesh that uses basic shapes, such as boxes, spheres, capsules, and convex shapes, to define the bounds of our object. Convex shapes are ones that have one or more interior angles that are less than 180 degrees, whereas concave shapes are ones that possess one or more interior angles that are more than 180 degrees, as shown in the following image:
In addition to these basic shapes, we can generate a form of simple collision called KDOP or K Discrete Oriented Polytope (where K is the number of axis-aligned planes). What this option essentially does is that it takes the K axis-aligned planes and moves them as close as possible to the selected mesh. We will go into more detail on how to generate these different types of simple collision later on. Now, let's define the different types of simple collision here:
The main advantage of simple collision is that it almost eliminates the possibility of an object getting stuck to a player or vice versa. An additional advantage is that the collision mesh is of a basic shape, which is less expensive to use in the game at runtime.
Complex collision is done for each polygon and is very expensive in Unreal Engine 4 as compared to simple collision. Moreover, complex collision is never used for an actor that is simulating physics, and it will just fall through the game world. In order to enable complex collision in the Static Mesh editor, we need to navigate to Details Panel and then to the Static Mesh Settings section. It is here that we can change the Collision Complexity parameter to Use Simple Collision As Complex or Use Complex Collision As Simple:
3.144.12.14