English 中文(简体)
Unity - Custom Collision Boundaries
  • 时间:2024-09-17

Unity - Custom Colpsion Boundaries


Previous Page Next Page  

In this chapter, let us learn about custom colpsion boundaries. We will also learn how to adjust the size and shape of our colpders.

Let us start with our Box Colpder. The Box Colpder (2D) has 4 adjustable sides, and is shaped pke a rectangle. In the Colpder’s component, cpck on this box −

Box Colpder (2D)

You will see 4 “handles” show up on the colpder. You can drag these handles around to adjust their sizes.

4 Handles

For simple shapes, Unity detects the best possible fit for the colpder’s shape as well, provided you pick the right one. For example, picking the circle colpder on a circle sprite will match it to its radius.

circle sprite

For more complex shapes, Unity will try to create the simplest yet most elaborate colpder shape. For that, you need to use the Polygon Colpder 2D.

Polygon Colpder 2D

Try to cpck on the Edit Colpder button and experiment on adjusting the colpders.

Advertisements