Area2D doesn't detect CharacterBody2D. Collision is not working

Godot Version

4.3.stable

What I have

I’m making a 2D top down Game with the following nodes:

Player:

  • CharacterBody2D with CollisionShape2D on collision layer 2 and active on collision mask 3

Grass:

  • Area2D with CollisionShape2D on collision layer 3 and active on collision mask 2

Desired Effect

I want the Grass to detect when the Player is stepping on it, emit a signal to the script attached to the Grass node that plays the grass animation.

What I tried

I have tried everything I can think of. I have searched online to see if anyone has the same issue.
And honestly, it seems to me that I understand how it is supposed to work. But it doesn’t.

I tried making the Grass node pickable and emit the signal when the mouse enters the Area2D and it works as expected.
I tried making activating the Area2D properties monitoring and monitorable
I tried all the signals that can be emitted by the class Area2D
I tried moving the CollisionShape2D on both the Player and the Grass to be the first child node
I tried playing around with Priority of the collisions
I tried playing around with the CollisionShape2D property Disable Node
I even tried turning it off and on again (close and re-open Godot)

Help! I am stumped

Images



image

image

Try declaring the body parameter on the signal parameter.

func stepped_on(body)

func stepped_off(body)

Having the exact same problem with same scene setup. Haven’t found the solution yet. I think it a bug in Godot it self not in the project.

Basically the node of the Player character was different than its instance in my main scene as far as the collision layer is concerned for some reason.
So when I fixed that, what you suggested was actually coming up as an error, so fixing these two things gave me the solution!

Thank you for you help

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