How to offset an object in world space with mouse input

I’ve seen other threads on how to move an object around using a mouse, but all of the solutions are reliant on either a hard coded variable or based on spring arm length like so:

My camera can freely rotate and zoom, so basing the transformation off of the spring arm doesn’t work. Instead of this solution, I’d like the object maintain its distance from the camera, but sort of “lock” to the plane of the camera screen while the mouse moves around. Sort of like when you’re transforming an object in Maya by using the yellow box (free transform) in the manipulator. The object moves parallel to the camera, but never changes z depth like this:

133956-free_transform.gif

I’m not the best with 3D math, so any study resources or including some of the math concepts in an explanation would be greatly appreciated! Thank you!

After banging my head against the wall for most of the day I finally got it!