Godot 3D Collision and physics: Stuck in a corner bug

Hello, I’m having this bug in Godot for a long time and unsure how to solve it.

I’ve tried applying collision parameter safe margin of 0.04 to Human CharacterBody3D.
It didn’t solve it completely, only made it more rare to happen.

Godot Version

4.4

Question

Here is the Basic Project that replicates the bug where a CharacterBody3D jumps in the corner between collision shapes and makes the player unable to move or jump out; which is weird. What would it take to completely solve it?


enable visible collision shapes then see what made it stuck

1 Like

I tried to enable it but it only confused me more.
However here is something more I’ve found that might be helpful.

If you try to widen the gap, will it eventually drop down to ground in that corner?

the Character is CharacterBody3D? or something else?

1 Like

Yes, it drops and allows to jump and move again. It’s weird.

my guess is you may want to add physics property to make character body 3D frictionless, or don’t use hard corner on terrain building to prevent this
i believe there should be settings to allow it to easily move on one side when it stuck right in the middle
did you modify the CharacterBody3D script or it’s default one?

1 Like

did you modify the CharacterBody3D script or it’s default one?

Everything is a default.

This is not a good or correct way, more like a last resort.

This bug seems to be forever in Godot Engine and it is really game breaking.
My mind is blank I don’t know what to do really, I think every project on Godot is affected by this.

Enforcing to not have sharp edges/hard corners in the project still may not resolve, only minimize the issue.

The project I’ve shared is default general playground for this issue on Godot to do experiment on and try to resolve. It’s very basic and the issue is basic, but I’m too new in the gamedev to know how to resolve it.

CharacterBody2D and 3D has its move_and_slide function, basically it checks collisions every physics frame and move to one side if collided which is not as quick as process frame. So there is possibility you encounter things like this, able to go through wall/get stuck by moving too quick to one direction.

have you tried using jolt physics? since it’s already Godot 4.4

1 Like

It’s one of the first things I’ve tried, it didn’t resolve it, although I’ve read on Google that for some it helped in some cases.

I’ve tested just now.
image

It felt different, but same issue of player unable to move or jump. Didn’t resolve anything.

All same issues persist.


Offtopic: So yeah, reverting back to default Physics Engine, since I’ve read Jolt have some different kind of bugs known. Even if Jolt would have worked, it’s too soon to use Jolt.

if you try to slow down the gravity, will it still get stuck? i wonder

i also might suspect the CharacterBody3D still think it’s on the air, hence there’s no movement can be made, try checking if it’s on floor or not

1 Like

Slowed down the gravity from 9.8 m/s to 3.8 m/s. Nothing new.
Player still gets stuck.

image

When player gets stuck in that corner, it is indeed not on a floor.

func _physics_process(delta: float) -> void:
	print(is_on_floor())

change this to 180:


It should be this on editor, not running:

gif:
cornerbug

Set it to 60 degree should be kind of perfect, so it won’t just able to climb wall like the GIF shown

1 Like

I have tested your solution of changing Max Angle to 60 degrees on both the sandbox and a real project and it most likely solves the issue, I can not see any new imminent problems. Thank you.

1 Like

Real project settings:
After further investigation Floor Max Angle to 60 degrees did resolve the issue but there was also a need to change Collision Safe Margin from 0.001 meters to 0.04 meters. to prevent same stuck issue.



Offtopic:
I personally also would recommend making the collision capsule smaller and placing at the bottom. This way making the character move through tight spaces easily.

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