Tileset corner collision issue

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Jesse Nazario

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

:bust_in_silhouette: Reply From: eons

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.

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?

Jesse Nazario | 2018-11-16 13:22