Compound colliders

Instead of using Mesh Collider, sometimes it is better to use combined primitive colliders. For this, we create a parent-child hierarchy of colliders. Let's see this in the following example.

Example – implementation of compound colliders

Here, we will see how we can implement a compound collider in the following scene:

  1. Create a new scene.
  2. As shown in the following screenshot, select the Capsule and Sphere game objects and create a character shape:
    Example – implementation of compound colliders
  3. Inside the Inspector panel, you will see Sphere Collider and Capsule Collider. Check the Is Trigger option for both to make it trigger a collider and fire trigger events.
    Example – implementation of compound colliders

In this section, we learned how we can use primitive colliders for a complex game object. We will learn more about animation and compound colliders in later chapters.

..................Content has been hidden....................

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