Move 3d objects in axis according to camera

I have a 3d object(cube) and I want to move it in a single axis according to both mouse-drag (which translates to up/down/left/right) and camera rotation around that cube. (to rotate the camera around the object I followed GitHub - EmmaPrats/Camera-Rotation-Tutorial: How to rotate the camera around an object in Unity3D.).

For example if the camera rotation is (0,0,0) and the swipe direction is up the direction Vector3 I get should be (0, 1, 0).
If the camera rotation is (90,0,0) and the swipe direction is up the direction Vector3 I get should be (0, 0, 1).

You can disregard camera rotation in the Z-axis. As I dont rotate the camera around it.

How can I achieve that?

Thanks

There’s a handy method of the Tranform class to use for this purpose.

To get a direction relative to a game object’s transform component:

Vector3 inputDir = new Vector3( Input.GetAxis( "MouseX" ), Input.GetAxis( "MouseY" ), 0f );   //Get mouse motion, I think it's called MouseX and MouseY, check the input settings though.
Vector3 camToWorldDir = Camera.main.transform.TransformDirection( inputDir );  //Creates a new vector pointing in the inputDir relative to the main camera's current rotation.