To edit polygon Colliders for more realistic 2D physics, follow these steps:
- Copy the project from the previous recipe and use this copy for this recipe.
- If you haven't done so already, import the Enemy Bug image from the provided assets. Then, in the Inspector window, for each Square GameObject, change the sprite in the Sprite Renderer component to the Enemy Bug sprite (replacing Square).
- Run the scene. You should see all the Enemy Bug GameObjects fall down into a pile at a low point where two triangles meet:
Figure 6.56 – Bugs falling into a pile. There's space in-between them due to the Square polygon Collider
- However, looking at the screen, there is some space between the Enemy Bug GameObjects, and looking at the Colliders in the Scene window, we can see that there are Square Colliders with lots of space around each oval Enemy Bug image:
Figure 6.57 – Square Colliders around oval Enemy Bug images
- Select the Square...