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

Bumpy RigidBody2D collision at TileMap seams #65204

Closed
monkeez opened this issue Sep 1, 2022 · 5 comments
Closed

Bumpy RigidBody2D collision at TileMap seams #65204

monkeez opened this issue Sep 1, 2022 · 5 comments

Comments

@monkeez
Copy link

monkeez commented Sep 1, 2022

Godot version

v4.0.alpha15.official [432b25d]

System information

Windows 11

Issue description

When a RigidBody2D moves across the point where two tiles in a TileMap meet, the collision becomes unpredictable. This makes it very difficult to make a physics based game such as golf without having unpredictable behaviour which would annoy the player.

Rolling on the ground the ball can bounce randomly:

bumpy01.mp4

When landing the ball can stop dead for no reason:

bumpy02.mp4

Steps to reproduce

  1. Create a scene with a TileMap floor (add collision shapes to the tiles in the tileset)
  2. Add a RigidBody2D with a circular collision
  3. Add a function for hitting the RigidBody2D around

Minimal reproduction project

tilemap_collision.zip

@Calinou
Copy link
Member

Calinou commented Sep 1, 2022

Duplicate of #32138.

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Sep 1, 2022
@monkeez
Copy link
Author

monkeez commented Sep 1, 2022

Would the current workaround be writing my own collision handling with move_and_collide on a CharacterBody2D node?

@Calinou
Copy link
Member

Calinou commented Sep 1, 2022

Would the current workaround be writing my own collision handling with move_and_collide on a CharacterBody2D node?

It may not fix the issue, as collision results will still return unreliable normals. I think the only 100% robust solution is to write your own physics in GDScript (or C#), using AABBs which are often sufficient for 2D arcade games.

Instead of using one collision shape per tile, generating a 2D convex hull for the whole tilemap and using this for collision is also an option. Maybe using a concave collision shape could work, so you don't have to write your own physics. Generating the shape based on the entire tilemap probably won't be trivial though.

@monkeez
Copy link
Author

monkeez commented Sep 2, 2022

Using the convex and concave hulls might work for me, but you're right, it won't be trivial.

Is this issue something that could feasibly be fixed? Or is it something core to the physics that cannot be altered?

@Calinou
Copy link
Member

Calinou commented Sep 2, 2022

Is this issue something that could feasibly be fixed? Or is it something core to the physics that cannot be altered?

The issue can be fixed in core, but it's not easy to figure out and fix without introducing regressions elsewhere. We have a general lack of physics contributors, so any help is appreciated here 🙂

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

2 participants