Tilemap collision with rigidbody2D

Godot 4.5.1

Hi everyone! I'm making a platformer 2D. I have a tilemap as walls and ground, a CharacterBody2D as player, and a rigidbody as a crate.

When the crate reaches the split between the two tilemap colliders, the crate stops immediately and can't be pushed again in that direction. I can limit the case to occur by changing the friction and the bounciness, but It won’t prevent players to experience that issue at some point.

I can’t neither prevent the split between the 2 tileset collisionShapes happening, since that’s the game engine tileset bakery system output.

I changed biais resolvers, continiousCD, but without success.

The sole solution I have found s far is to remove tileset collisionShapes and overlap walls and ground tiles by a CollisionPolygon2D to have a better control over how the collisionShape is split. It works finely, but I don’t want to do that extra work on each levels.

Any idea about how to solve that issue ?

1 Like

Hi!

The 4.x docs say TileMaps are deprecated and TileMapLayers should be used instead. I don’t know if that is related to your issue, but it might be worth giving it a try. :four_leaf_clover:

1 Like

Sorry, I didn’t write the node’s name entirely, but I do use a TileMapLayer.

I found a trick to get around the issue: adding a second CollisionShape2D with a SeparationRaycast2D shape, oriented to the bottom of the object and which exceed the main collisionShape of 0.15 unit.

visually, the rigidbody stick to the ground, in reality the collision occurs only on the contact point of CollisionShape2D. Now, the rigidbody doesn’t get stuck anymore.

1 Like

Interesting and creative solution!