0
0
Unityframework~10 mins

3D coordinate system in Unity - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - 3D coordinate system
Origin (0,0,0)
X-axis: left-right
Y-axis: up-down
Z-axis: forward-backward
Point (x,y,z) located in 3D space
The 3D coordinate system places points using three values: X (left-right), Y (up-down), and Z (forward-backward) from the origin.
Execution Sample
Unity
Vector3 point = new Vector3(1, 2, 3);
Debug.Log(point);
Creates a point at coordinates (1, 2, 3) and prints it.
Execution Table
StepActionXYZOutput
1Create Vector3 point123(1.0, 2.0, 3.0)
2Print point123Logs: (1.0, 2.0, 3.0)
3End---Execution stops after printing point
💡 Execution stops after printing the Vector3 point coordinates.
Variable Tracker
VariableStartAfter Step 1After Step 2Final
point.x-111
point.y-222
point.z-333
Key Moments - 2 Insights
Why does the Z value represent forward and backward, not left or right?
In the execution_table row 1, the Z value is set to 3, which means the point is 3 units forward from the origin, following Unity's 3D coordinate system convention.
What happens if we change the Y value to 0?
Changing Y to 0 would place the point on the horizontal plane at the same height as the origin, as shown by the variable_tracker where Y controls vertical position.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the Y value of the point at Step 1?
A1
B3
C2
D0
💡 Hint
Check the 'Y' column in execution_table row with Step 1.
At which step does the program print the point coordinates?
AStep 2
BStep 3
CStep 1
DNo printing occurs
💡 Hint
Look at the 'Action' and 'Output' columns in execution_table.
If the X value changed to -1, what would the point represent?
A1 unit to the right
B1 unit to the left
C1 unit up
D1 unit forward
💡 Hint
Recall that X axis controls left-right position in the 3D coordinate system.
Concept Snapshot
3D coordinate system in Unity uses Vector3(x, y, z).
X = left-right, Y = up-down, Z = forward-backward.
Origin is at (0,0,0).
Points are placed relative to origin using these three values.
Use Debug.Log to print Vector3 values.
Full Transcript
In Unity's 3D coordinate system, every point is defined by three numbers: X, Y, and Z. X moves left or right, Y moves up or down, and Z moves forward or backward from the origin point (0,0,0). For example, creating a Vector3 with (1, 2, 3) places a point 1 unit right, 2 units up, and 3 units forward. When we print this point, Unity shows it as (1.0, 2.0, 3.0). Understanding these axes helps place objects correctly in 3D space.