Serialize your other variables


For me, moving away from the camera means moving in the direction of the z-axis (not the x-axis, as in the video 4:34), or am I misunderstanding something wrong?

Hi Norbert,

What you describe matches your screenshot. For this reason, I doubt that you are doing anything wrong. You probably misunderstood how Unity works. See the three arrows on the camera in the scene? The z-arrow (blue) points “into” the screen. Your little “Main Camera” window shows that the camera is looking at the yellow cube, which is in front of the camera. See the blue arrow. It is pointing towards the yellow cube.

The red arrow represents the x-axis. As you can see, it is pointing to the right. That’s not the axis that will move the camera backwards or forwards relative to the cube.

Here is a screenshot from the video:
image

I inserted an arrow pointing to the 3D transform gizmo. Compare the gizmo to yours. As you can see, Rick’s view is rotated, so the x-axis points “into” the screen. By default, the x-axis points to the right like in your screenshot unless you rotate the view. Rotate your view if you want to have the same result as Rick.


See also:

Thanks for your answer! Apparently I couldn’t express myself clearly in the English language.

I’ll try to state my point of view again (more badly than right, also in English).

Initial position: main camera position 0, 1, -10; Player 0, 0.25, 0

Task: “While in player mode, make your player run away from the camera and then run back to the camera

My solution:

  1. Transform 0, 0, 0.01 after a short time 0, 0.25, 9.6; So about 20 m away from the camera!

  2. Transform 0, 0, -0.01 after a short time 0, 0.25, -10.2; So about 0 m away from the camera!

At 5:30, Rick changes the value of x, which means moving towards the camera from left to right. So I came up with the idea that changing z would fit the task better!

From what I read, you understood the coordinates in Unity correctly. What you did to move your player is also correct.

Whether you move the player along x-axis, the z-axis or another axis does not matter. Just the result in your game screen matters. If your game window looks correct and if the player moves as expected in the game window, you did everything right. :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms