Preventing the player from sticking to the edge of platforms
2D Game Design with Unity
🕑 This lesson will take about 7 minutes
In this lesson, you will learn how to fix a problem that might occur where your player GameObject gets stuck to the edge of platforms and other objects when the player is jumping or falling. This problem can be resolved using a few different methods including:
changing the type of Collider2D component (eg. from Polygon Collider2D to Capsule Collider2D)
adding a Physics Material 2D component to the collider to reduce friction (this can also be applied to a Tilemap Collider)
Watch the video below for the step-by-step demonstration and scroll down to view the sample code.
Game art, tiles and sprites from the Free Pixel Space Platform pack are used in this lesson video and can be downloaded from the Unity Asset Store.
Is YouTube blocked at school? Watch on Google Drive.
Next lesson: Animations in Unity