How would you go about making the player and projectiles both collide with the tilemap in different ways?

Godot Version

3.5

Question

Sorry for the silly question, I"m having a bit of difficulty in a 2D game where I want the player and bullets fired by enemies to both be able to collide with the tile map (and, in the bullets case, also the player)

I started using an area 2D for a bullet collision, and checking when it entered the player’s ‘hit box’ area. But for some reason I couldn’t get area 2D to collide with the tilemap/ world.

I tried using a rigidbody 2D for the projectiles now, and it collides with tilemap AND player’s (kinematic) body. However, I had to expand the collision shape attached to player’s body to make the bullet hit it right, and now the player collides more awkwardly with the scenery - for example they can’t go to anywhere that would collide with their head, even though its top down ish and the head should be able to go over the bottoms of walls for a sense of depth.

What would you do?

(also, apologies, I"m not sure which code to post here as its mostly about collision layers, bodies, areas, etc and things that are auto included in godot.

Tiles can have multiple physics layers with different colliders and physics properties.

thank you for the info.

is that the way to go then?

in my head it was the player who needed the different colliders, because the player needs to collide differently with tiles and bu llets. But I’m getting the feeling thats not the way to go?

Sorry for confusion. Just not 100% what i’d implement with the tile having multiple colliders/ properties.

because for me the problem SEEMED tO be the player and the projectile.

All things can have multiple colliders. You can set up collision layers/masks so that only desired colliders interact with each other.

Okay the answer seems to be that I’m not very observant and area2D projectiles CAN collide with bodies (including tile maps) so it just needed a second connection there ;-; So I can just use my old bullets that didn’t have rigid body, but had area 2d instead

ty for the help, Sorry that I’m kinda dense.

I’m testing the solution now to make sure it works, but um. I may have just been kinda dumb.

ah ty for info.

i see I’ve got a lot more to learn about colliders… :stuck_out_tongue:

I THINK I found a solution but need to test it, just wanted to thank you for your help (and your patience)