The coordinate system (world coordinate system and local coordinate system) in Unity of the chicken learning Unity

LZ-Says: Hey, time, time, slow down~

write picture description here


foreword

Today, let's learn about the coordinate system in Unity.

write picture description here

First of all, we need to be clear that in Unity, there are two types of coordinate systems:

  • world coordinate system;

  • local coordinate system

Below, an explanation is given based on these two coordinate systems.

1. The world coordinate system

The world coordinate system, which is based on our current game scene. Let's first observe the coordinates of a game object:

write picture description here

corresponding respectively. X, Y and Z axes.

Of course, the most direct way is to click on the upper right corner of the Scene view window to observe the X, Y and Z axes:

write picture description here

Observe the values ​​corresponding to the X, Y and Z axes of the property view window on the right:

write picture description here

So where is the origin of the world coordinate system? Let's quickly locate the center point:

write picture description here

Therefore, the world coordinate system is simply summarized as:

Based on the center point of the game scene, the coordinates of the X, Y, and Z axes of the game model.

2. Local coordinate system

The local coordinate system depends on the parent model. Of course, there is a parent and a child, and the relationship between the two is similar to that of the parent container and child controls in our Android.

The following is a simple model of a cube containing a sphere:

write picture description here

Let's first look at the coordinates of the cube:

write picture description here

Then observe the coordinates of the sphere:

write picture description here

It can be seen intuitively that the sphere is just at the center of the cube, that is, at the origin coordinate point of the center of the cube.

Next, we drag the cube and sphere respectively to observe the transformation of their coordinate points:

write picture description here

end

Over time, the rivers merge into rivers, and the sea contains hundreds of rivers~

write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324645683&siteId=291194637