Simple versus complex collision

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:

Simple versus complex collision

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:

  • Sphere: This creates a spherical bound mesh around the selected object. It can be used in physics objects and to apply collision to objects that are round.
    Simple versus complex collision
  • Capsule: This creates a capsule bound mesh around the selected object and is typically used for character or pawn meshes:
    Simple versus complex collision
  • Box: This creates a box bound mesh around the selected object. This type of simple collision is most commonly used for environment meshes:
    Simple versus complex collision
  • 10DOP X: This creates a box with four edges beveled in the X-aligned edges:
    Simple versus complex collision
  • 10DOP Y: This creates a box with four edges beveled in the Y-aligned edges:
    Simple versus complex collision
  • 10DOP Z: This creates a box with four edges beveled in the Z-aligned edges:
    Simple versus complex collision
  • 18DOP: This creates a box with all of its edges beveled:
    Simple versus complex collision
  • 26DOP: This creates a box with all of its edges and corners beveled:
    Simple versus complex collision

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:

Simple versus complex collision
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.12.14