The 3D Axis
-
Prerequisite
Description
In 2D projects, we use 2 arrows to represent the X and Y directions. In 3D projects, we use 3 arrows to represent the X, Y and Z directions:
You can use this block to add 3 arrows to represent X, Y and Z directions.Parameters
- visible: If “yes”, the 3D axis is shown; if “no”, it will be hidden.
- arrow length: a number that controls the length of the 3 arrows, which is 500 by default
Behavior
By default, the X-axis will point to the right, and the Y-axis will point into the screen, and the Z-axis will point up. They all start from the same point called the “origin”, which is the center of the 3D world.
The opposite directions of the 3 axes are called the “negative” directions. For example, the negative X direction points to the left, since it is opposite to the x-axis’s direction.
When you move the camera to look down from the top, you will find the X and Y axes are the same as the 2D axes. The benefit is that most objects would only move on the ground, so we only need to work with the X and Y directions in those cases.
Note on the Z-axis
Many people tend to forget that the Z-axis is the vertical axis that points up. To help you remember it, think of the letter “Z” as the shape of the stairs, which can help you go up:
Example Program
Note that you have to initialize a 3D scene before loading the 3D axis:
Different Coordinate Systems (Advanced)
There are many tools and platforms for working with 3D scenes. Unfortunately, they may define the X/Y/Z directions differently.
Here are some example systems for each convention:
- X points to the right, Y points forward, Z points up: CreatiCode, Tinkercad, Blender, 3ds Max, AutoCAD, SketchUp
- X points to the right, Y points up, Z points forward: Unity, Cinema 4D
- X points to the right, Y points backward, Z points up: Unreal Engine
- X points to the right, Y points up, Z points backward: Maya, Houdini
CreatiCode’s convention makes it easier for students who already know Scratch’s 2D coordinates. When you move the camera to look down from above, you would get the familiar 2D directions (X points to the right and Y points up), and blocks like “turn left” or “change x” would work the same way.
Learn More
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-