Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Godot 4] RigidBody2D gets stuck when moving along tilemap floor #72372

Closed
popcar2 opened this issue Jan 30, 2023 · 2 comments
Closed

[Godot 4] RigidBody2D gets stuck when moving along tilemap floor #72372

popcar2 opened this issue Jan 30, 2023 · 2 comments

Comments

@popcar2
Copy link

popcar2 commented Jan 30, 2023

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:

image

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
  • Watch it get stuck at some point

Minimal reproduction project

Platformer Quickstart.zip

Run the "Level 1" scene. Press 'X' to spawn a box, hold 'R' to restart the scene.

@Calinou
Copy link
Member

Calinou commented Jan 30, 2023

Duplicate of #47148 (and possibly others).

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Jan 30, 2023
@Rulft44
Copy link

Rulft44 commented Mar 27, 2024

Was looking for a fix on this issue too and stumbled across this https://github.com/popcar2/GodotTilemapBaker
It fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants