I'm having trouble clamping a CapsuleShape2D's position so it doesn't leave the viewport (following the Your first game tutorial)
https://docs.godotengine.org/en/3.1/getting_started/step_by_step/your_first_game.html#moving-the-player

The issue is that I can't seem to properly specify the top / bottom offset (the horizontal clamping works fine, the sprite can touch the left/right sides just fine). What I'm doing (and seems logical):
-clamp x between capsule radius and screensize.x - capsule radius (this works fine)
-clamp y between (capsule height + capsule radius) and screensize.y - (capsule height + capsule radius)
position += velocity * delta
position.x = clamp(position.x, 0 + $CollisionShape2D.get_shape().radius, screen_size.x - $CollisionShape2D.get_shape().radius)
position.y = clamp(position.y, 0 + $CollisionShape2D.get_shape().height + $CollisionShape2D.get_shape().radius, screen_size.y - $CollisionShape2D.get_shape().height - $CollisionShape2D.get_shape().radius)
the sprite can't go higher than where it's at in the screenshot
(same goes for bottom, there's a padding).
The CapsuleShape2D Radius/Height is 27 and 15 and matches the sprite used in the tutorial.