TerrorMan Both characterbody2D and TileMapLayer have collisions set. The collision Layer and collision mask Settings are characterbody1, 2 and TileMapLayer2, 1 respectively. There is a collision between them, but if the character moves into or passes through the soil block, a collision will occur. However, at an uncertain time, charaterbody2D will penetrate the TileMapLayer soil block. What's the problem with this? How can it be solved?
JusTiCe8 TerrorMan You're not very clear on your explanation and I guess "soil block" are the green patches showed in red on the second pic. You need to set/add a physics layer to the tiles of the tileset. Look on youtube for instance, there are plenty of tutorials for that.
xyz TerrorMan JusTiCe8 Thank you for your answer. I have solved the problem It's considered good manners to share the solution if you solve it yourself.
kuligs2 xyz its probably just a layer mask for collision shapes.. thats typical.. i keep forgetting to set the correct masks myself when starting new projects..
TerrorMan xyz The issue lies in the code, not in the mask or collision layer. After using the MoveAndSlide() method, I reset the Position of CharacterBody2D through some if statements, which caused teleportation and penetration. The collision itself is fine; the problem arises from modifying the Position after the MoveAndSlide() method