How can I make borders that adjust based on screen resolution and ratio ?

I’m making an android game in UE 5 where you simply keeping the ball in the air by pressing either the left or right side. My only obstacle, I have no idea how to do it. I want to make some borders (collision walls) on the left, right and top side of the phone. But depending on the phone screen size the borders will be placed accordingly.

For example, if I manually set the walls, on my phone it might be fine, looking as if the ball is bouncing off the screen side, but on a smaller screen size the ball will be slightly off screen or even go completely off screen, making the game annoyin . While on bigger screens it will seem as if it’s bouncing on nothing (which doesn’t affect gameplay that much).

So how exactly can I achieve these results ?
Here is a screenshot of how it currently looks (you can only see the top wall because the other are slightly off screen.)

Hi,

GetViewportSize(PlayerController) → Outputs (ViewportVectorXY

SetLocation(CollisionWallRight) (CollisionWallLocation + CollisionWall->Normalize(RightVector) * ViewportVectorX/2)

SetLocation(CollisionWallLeft) (CollisionWallLocation - CollisionWall->Normalize(RightVector) * ViewportVectorX/2)

For the top and bottom ones same but you normalize UpVector, also you can use camera right and up vectors to add padding to objects. For screen size changes etc you can receive an update or you can manually check if viewport size changed and reposition objects if not breaking gameplay.

Assuming ball is always in same Y depth from camera. Also if your camera is perspective you can add an additional magic number to be at the exact collision point.

Let me know if it helps.