Repository: godot
Issue: Erratic behavior when CharacterBody2D is inside tilemap (or group of small colliders) with collision shapes, is_on_floor returns false
Labels: bug,topic:physics,topic:2d

### Tested versions

- Reproducible in: v4.2.1.stable.official [b09f793f5]

### System information

Godot v4.2.1.stable - Ubuntu 22.04.3 LTS 22.04 - X11 - Vulkan (Mobile) - dedicated NVIDIA GeForce GTX 860M (nvidia; 535.154.05) - Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz (8 Threads)

### Issue description

I have a platformer character which relies on move_and_slide and is_on_floor to move following either grounded or airborne rules.

I noticed that spawning the character inside the ground/floor will cause it to stay airborne, accumulating downward speed indefinitely yet unable to move.

This is a common issue in game engines and sometimes by design for simplicity (letting the developer add a custom check in that case: some may want to force an escape, others to kill the character as if crushed...). However, looking purely at the API and method descriptions, it seems inconsistent with other methods, in particular `get_last_slide_collision` which *is* able to detect collision with the TileMap.

After creating a MWE I noticed other issues such as the character moving erratically, sometimes pushed away to the left and right in a seemingly undeterministic way (it seems to act the *same erratic way* on every run with a given configuration, so maybe it's just deterministic but depends on float calculations that small changes in values cause big changes in results, i.e. chaotic). `is_on_floor` still shows false.

The bigger the tilemap, the easier it is to reproduce: if it's too small, the character may get pushed to the left or right completely outside the tilemap and the experiment fails. However, it's easier to reproduce the bug by having the character slightly penetrate the tilemap from the top or bottom, as it can get stuck even if half-way into it.

### Steps to reproduce

0. Open the MWE project. It contains a demo scene with a character with a simple script to fall (and debug print `velocity` and `is_on_floor()`), a tilemap and a static body for comparison
1. Play the game in the demo scene to observe erratic motion of the character (the small Godot icon with a scale Y bigger than scale X)
2. Move the character around different places inside, and on the edges of the tilemap (the 3 big Godot icons, actually made of many tilemap pieces). Play again
3. Move the character inside / on the edges of the static body (the big Godot icon at the top-left) and play again: this one behaves OK
4. Move the character inside the 3 small static bodies at the bottom (which mimic a tilemap) to have about the same issue as in 2. Note that I tried adding more rows of static bodies, but it tended to push the character more easily and therefore make it *harder* to reproduce the issue... but with even more static bodies, maybe it could be easier to reproduce again.

Step 1 result:

[2024-02-07 Erratic behavior when CharacterBody2D is inside tilemap with collision shapes, is_on_floor returns false.webm](https://github.com/godotengine/godot/assets/1067772/dcb8968c-58ac-4d78-9966-70ec29e5df10)

### Minimal reproduction project (MRP)

[v4.2.1 - CharacterBody2D::is_on_floor returns false when character is spawned inside floor.zip](https://github.com/godotengine/godot/files/14197039/v4.2.1.-.CharacterBody2D.is_on_floor.returns.false.when.character.is.spawned.inside.floor.zip)