Need help zooming in towards mouse position

Hi! I am trying to replicate a RTS/Strategy game zoom, similar to games like Crusader Kings 3, where the zoom-in will be towards the mouse hover point, while keeping the position/object under the mouse throughout the whole zoom.

Link to example from Crusader Kings 3:

Zoom Function:

Tick Function:

Unfortunately, I am completely stuck at this, since I don’t honestly know a lot of the math required for this kind of problem. I have gotten a bit further with this issue with the help of GPT, but the main issue right now is that I want to calculate and offset the camera on the same frame. Currently I have not find a way to do this due to relying on Deproject Screen to World. This has lead to stuttering in the camera when zooming in as showcased below:

Video of current implementation:

I am running the function from an actor component on the player pawn, with tick group “Post Update Work”, this current solution won’t work if I don’t.

This zoom will eventually have a camera lag applied to smooth it out, and also pivot slightly while it’s zooming the closer to ground it comes, so any solution has to take that into consideration.

… add a spring to the camera. Attach the camera to the spring.
Modify the spring at runtime.