What I want to do is, be able to move my camera along the X and Y axis, without affecting the Z axis, using the mouse to move the camera around. Simulating like there was an “invisible plane” that guides the camera around.
Pretty similar to what these squares do while moving an object.
There are lots of ways to move an object in Unity.
The most basic method is transform.Translate. This method does not account for any kind of collision detection, though.
suggestedPositionWhichMightBeStraying, Vector3.up);```
or if you really meant the X Y plane and not the X Z plane (which isn't what your diagram shows),
```Vector3 newPosition = Vector3.ProjectOnPlane(
suggestedPositionWhichMightBeStraying, Vector3.forward);```
Just to clarify, what I want is to move considering de Y and X arrows, which I supposed Z wouldn’t be considered.
Or using the image, using the blue square from Z axis.
I will search more about Vector3.ProjectOnPlane tough, thank you for your answer.
Pay attention to what mode your Scene window is in:
Check your pivot/center and global/local buttons in the Scene window in the editor.
Shortcut keys are Z and X to toggle those.
This will NOT affect how something moves by code.
But it will profoundly affect your confusion working with it.
If you want it moving flat along the ground at a constant altitude, just update X and Z, leaving Y the same. This suggestion is just building on top of what @halley1 said above already.