Adjusting trajectory of an object

I’m fairly new to UE and working on a tennis VR game as a hobby project to learn some of the basics.

So far I have a setup where when the player hits the ball with the racket, it generates a predicted projectile path of the ball. I was wondering if there was a way to adjust or scale this trajectory to fit within a given range.

I attached a diagram of the basic problem I’m trying to solve. If the predicted projectile path falls within the given range (shown in orange), adjust the trajectory to fall within the actual play area (shown in blue). This would make it slightly easier on the players by reducing the required amount of movement while in VR to return the ball and reducing the amount of accuracy required when hitting the ball.

This is probably a simple problem, I just couldn’t find an answer anywhere else.

Any ideas or help is greatly appreciated!