Unity Axes - How do they work???

So if X in a 2d space is horizontal and Y is vertical what is Z???

And if X in a 3d space is also deemed as horizontal how is Z deemed as vertical when Y is vertical?? So what does why become in a 3d space?? I write the code, but I never asked the question because it works…

3d space:

Vector3 movement

movement.X = Input.GetAxisRaw(“Horizontal”)
movement. Z = Input.GetAxisRaw(“Vertical”)

1.(What is Y if why = jump??? And jumping is vertical??)

2.(And how is Z vertical when its also on the horizontal plane???)

2d Space:

Vector2 movement

movement.X = Input.GetAxisRaw(“Horizontal”)
movement. Y = Input.GetAxisRaw(“Vertical”)

My topic is wrong I could pick one for some reason…

You’re mixing up several things here.

The X and Z components of a Vector3 define the horizontal plane in the game world. When you are in 2D, the Z axis does not have any effect.

The Y component of a Vector3 defines the vertical axis in the game world


Input.GetAxis & Input.GetAxisRaw take strings as argument which are “keys” / identifiers used in the Input Manager. Unity decided to call “Horizontal” the “axis” formed by the keys A + D and Left Arrow + Right Arrow and “Vertical” the “axis” formed by the keys W + S and Up Arrow + Down Arrow, but it could have called them otherwise. Feel free to rename them to avoid the confusion.

By axis here, understand a pair of buttons, one to go in a direction, the other to go in the opposite direction.