Translating 3D object along a screen space plane

Godot Version

4.2.2

Question

Let’s say I have a first-person character and I can walk and rotate around. When I’m pressing Ctrl the mouse cursor appears and I can click on specific objects, get and change its properties, including reparenting.

I can’t figure out how to translate the object on my viewing plane. I want it to behave like Move Mode in 3D editor where when I’m dragging mouse while no particular gizmo axis is chosen.

I’m sure there is a way to do this, but I had no luck with it so far?

Hmm. It should be based on the camera’s transform.basis, I guess? Like, if you take the camera’s XY plane, and translate that along the camera’s Z axis to whatever distance the object is at, that’s the plane you wanna move it on, right?

There’s a function in the Camera3D class called project_position that takes a point on the screen (such as the current mouse location) and a Z depth, and gives you a position in 3D world space. That seems like it might do most of the trick?