0 votes

Hey guys,

I'm still a beginner at Godot and we are in the progress of creating a 2D game rn.

The problem is fairly simple I guess.

Context:
We have a TileMap (Autotiles) with rectangle collision shapes.
We have a map with those tiles being walls.
We have a player who can shoot RigidBody2D projectiles.
The projectiles should ricochet on the said walls.

Problem:
The ricochet works perfectly on the walls, but not on the wall tiles edges (where the tiles are next to eachother). There is no actual separation between the tiles. They are aligned perfectly in the TileSet editor and on the map itself and there is no gap configured.

On the edges the projectiles (I tried different CollisionShapes: Capsule, Circle, Rectangle) will behave weirdly. If you aim directly at an edge the projectile will come right back at you or will even be reflected deeper into the wall, which will result in the projectile even go through the wall completely. For the player this behaviour does not make sense at all.

Have a look (CollisionShapes are visible):
https://imgur.com/a/N8ehVML

I believe I understand why this is basically happening. The thing is, that at the edges there is no collision normal the projectile can reflect on normally, just two edges at virtually the same place.

My question is: How to deal with this kind of problem? Is TileMaps for something like that a bad decision alltogether?

Would it make sense to write custom reflection code and how to start?

Can the TileMap collision shapes somehow be fused together?

Thank you for any suggestion and help!

Godot version 3.4.4
in Engine by (48 points)

I tried to upscale the whole thing, so that I use FULL HD resolution just with upscaled pixelated textures, hoping that its just because of the subpixel scale, but it doesn't help.

Bullets still can go through the walls at the tile edges. Its also possible to still shoot the edges, so that the bullet reflection is just wrong. :(

TileMaps with Physics is probably not a good idea at all?

Please log in or register to answer this question.

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.