Moving Along Z Axes

How do I…

Move player character on the Z axis in 3d.

I have added code for the player to move along the x and y axes and also look around following your mouse, but I would like the same to be done for the Z axis and I cant figure out how.

Related screenshots

Currently, the cube is able to rotate along the y axis and move accordingly based on where the mouse is. I cant figure out how to get it to move up and down based on where your cursor is. The image below represents what i would like to happen.

I can’t think of way that you can with just the mouse. Here are some possible methods. Think of how they do it in other 3d editors.

You could add a toggle button or variable that could change the mode from from one axis to another.

You could add keyboard shortcuts like page up and page down for the Z. Or a modifier key. If key is pressed plus cursor.

You could have up and down buttons appear next to an object when the mouse is over or near it.

Maybe, clicking on the object causes it to change to z mode. And you could then drag it up or down. Or have it move towards the cursor.