Godot Version
v4.
Question
I have implemented a mechanic whereby the player can go through platforms, if he presses the down button, he will fall through, or if he jumps under it, he will fly over it and stand, but I have a big problem that is very annoying. If the player jumps under the platform and ends up not going through it, but stops his collision in the middle, then he will simply get stuck in it. I understand why this happens, but I don’t know how to optimize this moment
func platform():
if Input.is_action_just_pressed("down") and is_on_floor():
$TimerPlatform.start()
if Input.is_action_pressed("down") or velocity.y <= 0 or !$TimerPlatform.is_stopped():
set_collision_mask_value(3,false)
else:
set_collision_mask_value(3,true)
Please help, I don’t understand how games create such a pleasant platform experience.