Can a capsule 3DCharacterBody stand on an edge of the collision?

Godot Version

4.2

Question

I was wondering if there’s a way to have a capsule collider body not stop/stand on a flat edge, but rather slide down and fall like it should physically do.
I have 2 walls that diagonally meet at an edge at a certain height.
My character can jump on that edge and land on it perfectly in balance.
I thought about making a reverse pyramid sort of collider for the character instead of the capsule but I’m not sure it’s a good idea.
Is this normal behaviour and is there a way around this?
I thought maybe friction is what keeps the capsule from sliding down, but it should be irrelevant for CharacterBody

There is, but that would be more complicated than just using a Rigidbody as your character body. Is there a reason that you need to use a 3DCharacterBody? A 3DCharacterBody uses move_and_slide() to move, this means that the 3DCharacterBody will move in the direction of your velocity until it has a collision and then it will slide along the colliding object if possible. So 3DCharacterBody will always stop when it collides with the ground since it’s flat, even tough the collision is small.

Thanks the the reply.
I’m using CharacterBody3D because wall slide is precisely what I need when colliding with walls ceilings and floors, though I could implement it myself based on move_and_collide if needed.

I worked around the problem by creating a custom collision shape for the character that looks like a reversed cone, this way the collision on the bottom is a single point and it becomes impossible to stand on 0-width edges of the collision.
Seems to do the job but feels like a workaround lol

I think the issue is that when CapsuleShape collides with the edge (on top of 2 diagonal walls), it does so with an arbitrary angle (from 0 to 90) depending on the point of the semisphere that happens to hit the edge.
If that angle is smaller than max_angle, the engine considers that to be floor regardless of the inclination of the walls.

I just wish there was a way to explicitly mark walls as walls and floor as floor, instead of just relying on the angle as it feels a bit fragile.
Anyway thanks for the help

1 Like

Simple and effective! If I understood the problem correctly, I would have added an Area3D node to the bottom of the body and made it smaller than the body’s bottom radius. Then when the area stopped detecting the ground but body detected it still I would have added some velocity in the opposite direction where the collision happened. This would add a lot off edge cases and probably isn’t what you wanted.