Yes, this is an super common issue and has come up dozens of times:
Since you use irregular shaped tiles and use the tile graphics itself to trace the collision shape you will potentially run into problems like this. My recommendation would be to use a different PNG for the collision shapes with completely square tiles for the walls instead of the irregular ones tracing the outline of the vines etc
Hey there.
I am moving a character (player) on a tilemap. The tilemap has collisions.
If the player runs around/near a corner he’ll stuck.
Does anyone has an idea how to solve this or how to do it better?
Game can be tested here: (Use F9 for the physics debug)
http://foodrescue.trinium.de
Here are some code-snippets how the input and movement works:
the tilemap is a simple tilemap with 2 layers - a background and a front with some furnitures etc. Nearly all tiles have a collision set up …
Good explanation:
Just to be clear, this is not a “bug”! Box2D is working exactly the way it should be.
Because Defold treats each tile as a separate shape (for good reasons), life is a bit more difficult than you might expect, but it’s not all Defold’s fault either. Nor is this just a problem with tilemaps. Any time you want to build a continuous surface out of multiple pieces you’ll run into this. Unfortunately, no physics engine can read your mind.
Given two overlapping bodies, the physics engine will calcul…
You’re better off using raycasts for platforming collisions rather than collision shapes. Check it out here:
There are also a few platforming assets in the Asset Portal that use raycasts to solve this problem. Maybe try studying them a little bit to learn how they work if you’d rather implement it yourself:
Defold platformer engine
6 Likes