i am attempting to implement the solution in the reply to this post.
this is all the code related to said solution:
func floor_frames_update() → void:
floor_check_frames[2] = floor_check_frames[1]
floor_check_frames[1] = floor_check_frames[0]
if is_on_floor():
floor_check_frames[0] = true
else:
floor_check_frames[0] = false
func better_floor_check() → bool:
for frame in floor_check_frames:
if frame == true:print(“true”)
return true
return false
(i’m aware my code is sloppy)
the issue a am having is that it seems to only ever return either [true, true, true] or [false, false, false] and it flickers between the two when grounded witch is the exact issue i was trying to fix, i call floor_frames_upadate() at the end of my physics tick, right after move and slide.
from my debugging it seems that for whatever reason every time the code loops back to my update, the array is reset to all false or all true
(i did this by putting a breakpoint on my check returning true, then putting a break at the top of my floor_frames_upadate() and hitting f12 to see what it reads every tick)
i have checked my code, run through it over and over, plugged it into an AI at least 3 times and trying to word the question differently to get the stupid thing to tell me im dumb and point out something obvious but it just keeps asking clarifying questions.
it feels like I must be missing something but i couldn’t find anything about it online and this is kinda my last resort before just figuring out another solution.
Frame 0 - res://Content/Player/player.gd:268 in function ‘floor_frames_update’
Frame 1 - res://Content/Player/player.gd:250 in function ‘_physics_process’
this is what i get when i put print_stack in the update, its just this over and over.
i do have some testing dummy’s that inherit from the player with checks to stop them from moving, could those somehow be messing with it?
I restarted worked on other parts of my project for a bit, restarted my computer and tested again after awhile and it works just fine. no idea if the stuff i did fixed it or just the restart
i was having this problem yesterday and ive obviously restarted since then, i fully reworked the movement in the meantime but none of it used any of the functions that were causing issues beyond running the check for whether or not to apply grounded physics so i haven’t a goddamn clue what the issue was.