I'm trying to drag objects with the mouse on the X, Z axis only, so it goes back in space and forward.

I dont have a clue how to start implementing this. I've looked into casting a ray into the scene from the mouse position. But I want to drag the object and not just move it to that point. Do I use RaycastHit.point from the pointer location? If so how do I only calculate the change in the X and Y from my object origin? Can somebody provide some direction for me.

One method of doing this:

Use a raycast to find the object you're selecting to drag (i.e. on initial mouse click).

Then, when the object is being dragged, use the input mouse position to find the new coordinates, using either Camera.ScreenToWorldPoint (this requires a "depth" from the camera in world space units, so is probably only feasible if the camera is a set distance from the plane of movement), or use Camera.ScreenPointToRay and perform an intersection test with your movement plane.