Editing polygon Colliders for more realistic 2D physics
In this recipe, we will address the issue of the simple geometric polygon Colliders used as sprite placeholders not matching the final image sprite that replaces the placeholder. This will allow you to use polygon Colliders to approximate the shape of any image outline you might use in your game.
Getting ready
This recipe builds on the previous one, so make a copy of that project and work on the copy for this recipe. We’ll also be using the Enemy Bug
image from the first recipe in this chapter, which can be found in a folder named Sprites
in the 08_01
folder.
How to do it...
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 panel, for eachSquare
GameObject, change the sprite...