+1 vote

I'm trying to use a RigidBody2D (the ball from the gif) to collide against tiles (which have rectangular shape collision) from a tilemap, but, as shown in the gif, my ball seems to hit the tile corners and go the opposite direction. When using a entire rectangular shape without the tiles, it works properly.

I also tried replacing the tiles with many side by side rectangular shapes, and noticed the problem still persists. So, as I understand, when the ball hits the division of two shapes, it collides with the "wrong" one. I think the only solution would be to join the bodies of the neighbor tiles into a single shape. I'm not sure if that's possible in Godot.

Has anybody faced this issue? Is there a workaround?
enter image description here

in Engine by (13 points)

1 Answer

+1 vote

There is no simple solution for that, it may be related to precision problems on top of the lack of determinism on the physics engine.

You can try to manually do corrections to the velocities on hit, with a custom integrator.

by (7,860 points)

I was hoping for a different approach which I wouldn't need to mess with the physics logic. Before Godot I used libGDX with Box2D, where I imported the tileset from Tiled and created the body shapes manually through code, joining the neighbor tiles in a unique single body, which worked perfectly. Is such thing possible in Godot tile system?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.