Godot Version
4.5.1
Question
Hi,
I’m just starting out with Godot and ran into something I don’t quite understand.
In the default CharacterBody2D movement template, the script checks whether the character is standing on the floor using is_on_floor(). However, when I run it, the character doesn’t move properly — it keeps trying to move downward, as if it’s not on a surface.
Visually, I can see that the character is colliding with the floor and not falling, but is_on_floor() keeps returning false (I confirmed this using print()).
Interestingly, if I replace is_on_floor() with move_and_slide() — which, as far as I understand, internally also uses is_on_floor() for floor detection — it works correctly and the character starts moving as expected.
Why does this happen?
Is this template code perhaps a leftover from an older Godot version, or has the logic of these functions changed recently?