Rigidbody2D can not detect the body_entered signal of the CharacterBody2D node

Godot 4.2.2

there is the repo: GitHub - YuFengjie97/knight_adventure: godot game


Player(CharacterBody2d) rush to Enemy(RigidBody2d), Enemy’s _on_body_entered not trigger.
but when Enemy fall down on the floor, it can trigger body_enter

I also have check the contact options

here is the Enemy’s gdScript:

there is the screenShot, it can trigger by tileMap block,but can’t player:

if I put Enemy on the player up direction, when I run game, Enemy fall down, it can trigger by player

1 Like
  1. What type of node is suitable for moving enemies? in this example, I use rigidBody2d,but it looks like godot doesn’t recommand me to do like this.
  2. by the way, I have check some a tutorial, it use gdScript to control enemy to move. but also can use animatePlayer to control.I think it’s easier to use AnimatePlayer customization,what do u think?
1 Like

when player collision mask layer include enemy, and also enemy collision mask layer include player,
rigidBody body enter it doesn’t work,
if clean the enemy in mask layer of player, it will work fine!!!

1 Like
  1. Character body 2d is best if you want it to be easier to move., as it has built in velocity.
1 Like
  1. No, an animation player is, as it says, an animation player, so it can’t help you here.
1 Like

I write a new easy version to show this bug.maybe godot bug
here is the repo: GitHub - YuFengjie97/test-rigidbody2d

this is why enemy(rigidbody2d) signal body entered doesn’t work

when I set player collision mask player include Enemy layer , the body_entered doesn’t work!!!

I really don’t know why,the godot tutorial doesn’t teach this.Maybe they conflict with each other.????