How to make a function trigger when the player hits the floor? (2D)

Godot Version



I’m making a 2D platformer with a simple jump mechanic.

It’s a pretty simple question, but I can for the life of me not figure it out. I want to have my character emit some particles when they land on the floor, i already have the code for the particles, I just need something to make it trigger when my character hits the floor. I’ve tried to use is_on_floor but it doesn’t work the right way sadly.

You could set the particles to emit whenever both the player’s y velocity is 0 and the player is on the floor. I’m assuming the issue with using is_on_floor() is that it constantly fires, but combine it with the velocity.y being 0 and it will cause the particles to only emit when the player just hit the floor.