Topic was automatically imported from the old Question2Answer platform.
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.
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