You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RigidBody2D seems to have a tendency of getting stuck in-between tiles. Using square corners, my RigidBody2D box would constantly get stuck when I'm applying force along the X axis. This issue doesn't seem to happen when the RigidBody2D is on a completely smooth surface like a StaticBody2D. It's also worth noting that I have rotation disabled on the box.
I triple checked and am sure that my tiles all have a square physics shape.
Video showcasing the issue:
Bad_Slide.mp4
Video showcasing the same box on a StaticBody2D (this is how it should be):
Good_Slide.mp4
The Band-Aid Solution
A simple but not perfect fix would be to never use square edges when interacting with a tilemap. Something like this sort of works:
But unfortunately this makes stacking boxes more difficult, and the issue doesn't go away completely. The box still bumps slightly when moved along the tilemap:
Bumpy_Slide.mp4
Proposal
As a Unity developer that's coming in hot to Godot, this is exactly why we have composite colliders there. Every tile having its own separate collider is bound to cause issues. A way to bake collisions would be an instant fix. I see that Godot already has a CollisionPolygon2D, maybe there can be an automatic way to wrap the Tilemap with it?
Steps to reproduce
Draw a tilemap
Create a RigidBody2D with a rectangle collider
Place it on the tilemap and apply force along the X axis
Godot version
4.0.beta16
System information
Windows 11, RTX 3060Ti, Compatibility backend
Issue description
The Issue
RigidBody2D seems to have a tendency of getting stuck in-between tiles. Using square corners, my RigidBody2D box would constantly get stuck when I'm applying force along the X axis. This issue doesn't seem to happen when the RigidBody2D is on a completely smooth surface like a StaticBody2D. It's also worth noting that I have rotation disabled on the box.
I triple checked and am sure that my tiles all have a square physics shape.
Video showcasing the issue:
Bad_Slide.mp4
Video showcasing the same box on a StaticBody2D (this is how it should be):
Good_Slide.mp4
The Band-Aid Solution
A simple but not perfect fix would be to never use square edges when interacting with a tilemap. Something like this sort of works:
But unfortunately this makes stacking boxes more difficult, and the issue doesn't go away completely. The box still bumps slightly when moved along the tilemap:
Bumpy_Slide.mp4
Proposal
As a Unity developer that's coming in hot to Godot, this is exactly why we have composite colliders there. Every tile having its own separate collider is bound to cause issues. A way to bake collisions would be an instant fix. I see that Godot already has a CollisionPolygon2D, maybe there can be an automatic way to wrap the Tilemap with it?
Steps to reproduce
Minimal reproduction project
Platformer Quickstart.zip
Run the "Level 1" scene. Press 'X' to spawn a box, hold 'R' to restart the scene.
The text was updated successfully, but these errors were encountered: