is_on_floor() returns true on the frame where a KinematicBody2D moves off of a ledge

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TheBroodian

Basically title. On the frame where a body may begin its physics frame colliding with the floor, but after move_and_slide() ends the frame in mid-air where it has moved off of a 90-degree ledge, the is_on_floor() method returns true. This creates issues when trying to do evaluations about whether or not there is ground under the feet of a body on a per-cycle basis.

:bust_in_silhouette: Reply From: Surtarso

are you talking about the coyote jump problem?

if so, just add a timer of a fraction of a second to maintain is_on_floor and create a variable “was_on_floor” to check is_on_floor right before the move and slide function

    var was_on_floor = is_on_floor() #checks if im on floor before applying movement
	motion = move_and_slide(motion, UP_DIRECTION) #apply movement
	#check if not on floor now but was on floor on move_and_slide() above
	if not is_on_floor() and was_on_floor and not is_jumping: #smoother ledge jump
		jump_timer.start()

also make sure u set floor angle so that a wall is wall