Hello y’all. I’m having a problem with the is_on_floor function. It’s not reporting correctly but only under a certain circumstance. If im going fast enough and I drop into a hole which is just a bit wider than the characterbody’s collision shape, it stays true the whole time its falling down the hole, as long as I’m pressing the movement input the whole way down.
I tried setting the safe margin to the lowest value yet it still persists. Any ideas?
I disabled the camera but it still reports incorrectly. I suspect it might have to do with how narrow the hole is but I will have to further inquire to find out what is causing it.
Could it be possible that this is caused because my characterbody collider is very small, I think it is only 2 units wide and about 8 tall.
Try to increase “physics/2d/solver/solver_iterations” in your projects settings or “physics_ticks_per_second”. Since your collision area is very small and movement speed is high it’s probably requires more precise calculations. It will increase CPU load though.
But it’s weird, that it still falls in the hole, so my assumption may be pointless.
As alternative, you can use ray casting, just for checking if there is floor under character.
I haven’t tried your suggestion yet but is there any downside to making the character collision larger? If its okay I might just do that.
The only reason I made it small in the first place was because I’m eventually going to render the game in low res so I thought it fit but it might be giving me too many problems lol.
Im not sure if it is caused by the size but I will play with it when I get home
As i understand, physics resolved correctly, and CharacterBody fell into the hole, so there is no problem there. But since is_on_floor still stayed “true”, that means its calculated separately from physics, and most likely have its own raycasted vector pushed into a wall while you still holding directional button. So my suggestion in this case is just use your own raycast after all positional calculations (like move_and_slide) are done.
I tried to increase solver iterations but nothing. I’m not sure why this is happening but I guess I will have to use a raycast to check floor myself. I was just trying to avoid making something that already exists in Godot but if it doesn’t work then I have no choice lol
If this is a bug, hopefully it can be fixed one day, I might come back to this and open a topic in the official Godot bug report but I’m still unsure on how to replicate it. Anyways, thank you for all your help.