Panning the Camera Based on a Fixed Point

So what I am trying to accomplish is moving the camera’s x and y around based on the point where the mouse first clicked. So whenever the mouse is moved, the camera moves so that point remains under the mouse.

This is a 2d perspective so the z position of the camera does not matter.

How would I go about accomplishing this?

Thanks!

When the mouse is held convert the screen position to a world position and subtract it from the previous world position of the mouse (this can be done by logging the mouse position again at the end of the function and putting it in a vector). Take the inverse of the result and add it to the camera transform.