Panning accros the global Z plane

I have a camera tilted at 60 degrees facing down. By moving the mouse to the top of the screen, I wanted it to pan across the global Z plane, but obviously if I use a ‘transform.forward’ would only move the camera’s local position.

Had a newb attempt using InverseTransformPoint/InverseTransformDirection, which to my understanding converts the global position (0,0,1) to the camera’s. I guess its not that simple.

if (Input.mousePosition.y>= Screen.height - mDelta)
{
transform.position += tranform.InverseTransformPoint(0,0,1)*Time.deltaTime*mSpeed;
}

After further reading I’m probably wrong with this to start of with and might involve the use of interpolation or vector normalization? Argh. I’m confused.

An easy way to do this is to put the tilted camera inside a non-tilted parent object and attach the movement script to the parent.

If this isn’t acceptable, then you can get the forward direction of the camera parallel to the XZ plane quite easily. Use camera.transform.TransformDirection(Vector3.forward) to get the camera’s forward vector. Then, remove the y coordinate by using Vector3.Scale with a scale vector of (1, 0, 1) (ie, no y coordinate). You might also need to normalise the resulting vector, depending on what you are doing.