basically I'm trying to make it so that the top margin of a Camera2D which is a child of a CharacterBody2d has a margin that changes depending on whether or not the character is on the floor. I wrote the following code:
if is_on_floor():
$Camera2D.drag_top_margin = move_toward($Camera2D.drag_top_margin, 0, delta)
else:
$Camera2D.drag_top_margin = 1
It works mostly, but there's a strange issue where there's a solid fraction of a second where the camera doesn't visibly move when the character touches the ground. I would like it to continuously move the second the player touches the ground. Weirder still, when I set it up so that the camera margin is printed to console, the value does consistently change but the change isn't visible. I've also tried lerp but still had same issue. (sorry if this is dumb or poorly written I'm new to godot)