If we think of the Mario games, Mario usually takes damage if he touches an enemy, except if he lands on top of them, then Mario is fine and the enemy is damaged.
I was thinking that to accomplish this, I would do raycasts checking below the player’s feet to register contact with the enemy. I would also check that the player is in the state of falling. And I see that ray_cast_response gives us a position, which is the world position of the hit.
My question is how can I tell if that hit position is above the upper y boundary of the enemy object? This way it would only hurt the enemy if you were actually on top of them, and not, for example, crashing down and hitting them in the side.