Detect collision between StaticBody2D and CharacterBody2D

This issue may be caused by the order in which you handle the simulation. Here is another post I wrote:

I noticed this issue while working on physics simulations with the state machine, where a slight change in the order impacted the simulation quality.