How to stop kinematic body on wall

Godot Version

4.2.1

Question

Hello, I had kinematic body and static body in Godot 3.5.2 where colliding with static body automatically stopped kinematic body movement…

Now I converted project to 4.2.1 and kinematic body just pass the static body like it doesnt exits…

How does static body and kinematic body work in godot 4, I can make it detect, when it hit the wall(1st time), but any new “collisions” wont be detected since this way only entering/exiting is sent once so kinematic body will still pass the wall in end…

Kinematic bodies are not affected by physics at all, can only affect other rigid bodies. You can use CharacterBody if that’s the intended use, or you can use Area nodes to get constant collision functions for tests.

1 Like

Thanks for answer :slight_smile:

Checked the converted version and its actually characterBody2d(so it got converted from kinematicBody to characterBody automatically during godot4 conversion), but the issue remains…

I was using area2d for detection there and it seems that in godot 3.5 the walls were automatically detected by either kinematicBody or Area2D and stopped the player…

But it Godot 4 it require to add in characterBody>Collision>Mask “Layer” of walls to actually stop the player(In godot 3.5 it wasnt “required”…)

Btw adding wall layer to area2D mask didnt work, it had to be in characterBody…

Well, yeah, if you’re converting, it’s complicated. CharacterBody2D has a lot of (good) functionality for those cases, but it is more complicated to set up. The flip side is you don’t have to do the detection with areas, just set the layers and masks correctly. You don’t even need to change the behaviour if you’re using move_and_slide().

1 Like