CharacterBody2D collision not detecting TileMap collision

Godot Version

4.2.1

Question

Hello! So I’m trying to make a 2D RPG game and for some reason I can’t get the collisions to work? I’m pretty new to Godot so I might be missing something but as far as I know, I did it correctly
My CharacterBody2D has a CollisionShape2D. The layer being ‘1’ and the mask being ‘2.’

I made the collision for my TileMap, I added a Physics Layer, I selected the whole thing and set the layer to ‘2’ and mask to ‘1.’ yet for some reason it still ignores the collision?

If anyone could help, it would mean a lot!

Show example of tile with collision, must be something like this
image

Here’s an example of some tiles with collisions that I have

What sort of collision are you looking for?

Stopping the player movement or activating something in code?

stopping the player movement whenever they go near an object so they can’t walk over it

Enable Visible Collision Shapes option
image
Or this option in TileMap
image
Run from editor and see if colisions exist in game
image

If they visible, show your Character2D movement code or check you not set it position directly and use move_and_slide()

OH I forgot to include move_and_slide() in my character’s code. thank you so much though! it was kind of a silly mistake on my part but again, thank you for the help!

1 Like

I’ve been caught out by that many times! :laughing:

1 Like

I also get caught out forgetting to add “On Body Entered” connections and wonder why my code doesn’t work.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.