- Home /
Creating one-way platforms with dynamic colliders in a 2D vertical platform jumper
Introduction: The game is a vertical 2D platform jumper, like Doodle Jump. The key point of the game is that it can be customized by the user. When the game starts it loads the images for the player, platforms, background, etc. from a folder on the device. After the images are loaded, the colliders are generated so that they follow the shape of the image.
Problem: Creating one-way colliders for the platforms. So the player can go through the platform from bottom-to-top and can go through the sides of the platform.
What I tried: Because the colliders are automatically generated, the player’s feet are always different.
• Platform effector 2D When the player hits the sides of the platform, the player collides with the platform. I want the player to go through the sides of the platform.
• Generating the player feet automatically When the player is generated I calculated the width of the player and the lowest point and placed a collider there, resembling the player’s feet. This is not a great solution, because when the player had a wide torso/body, but very small feet, he will hit the platform even when his feet are not touching it.
Other solution I’m thinking of:
Calculating the highest point of the platform & calculating the lowest point of the player. When the lowest point of the player (his feet) exceed the highest point of the platform, enable the platform collider. I’ve tried to implement this, but it was too buggy/slow with some platforms working and others not.
Is there someone who can think of a solution for this problem? :)
Thanks in advance!