Detecting Collisions on CharacterBody3D that's not moving

Godot Version

4.2.2

Question

Hi! First time posting here, Unity refugee :slight_smile:

The player is a CharacterBody3D, I’m currently coding interactions with enemies, but I can’t get collision detection to work when the player is standing still.
GetSlideCollision only detects collisions when Velocity != Vector3.Zero, so just calling MoveAndSlide while not actually moving the player doesn’t work.

The enemies are also of type CharacterBody3D.

A BodyEntered signal would have been wonderful on a CharacterBody3D :smiling_face_with_tear:

Thanks!

you can add an area3D as a child to the enemy and use the BodyEntered signal that way

CharacterBody3D and Area3D are in conflict, as they both require a collision shape. I can add shapes to both but that seems contrary to how Godot works

1 Like

you can enable keep active on Colision>disable mode

I created a simple test project. Notice the overlap:

The TestNode collision code:

Run results:

Coming from Unity, I’m assuming you’re using C#, but it should work the same in gdscript and C#. I don’t use C#, so I can’t make a test program using it.