Unity --- 3d mathematics --- coordinate system

 

 1. The world coordinate system is fixed

2. Each game object has a corresponding coordinate and direction in the world coordinate system

 1. The position of the pivot point is not fixed, it can be set manually

1.Screen Space --- screen coordinates 

2. The screen we see is actually the position of the plane where the camera is located --- and the Z of the screen coordinate system is actually the vertical distance from the object in the game to the camera plane

1. The difference between viewport coordinates and screen coordinates is --- screen coordinates are in pixels, while viewport coordinates have no units (can be regarded as a ratio) 

2. The screen coordinate system is obtained according to the specific hardware screen parameters. Since different screen hardware will bring different screen coordinate systems, if we only operate according to the current screen coordinate system when designing the program, once the screen is replaced There may be problems with the coordinate system --- In order to solve this trouble, people have made a viewport coordinate system

3. To put it bluntly, the viewport coordinate system is a proportional coordinate system. The lower left foot is the origin, and the upper right corner coordinates are (1,1), which means that the maximum value of the x-axis and y-axis is 1 (no unit) --- At this time The real meaning of the coordinates in this coordinate system is actually the ratio --- such as (0.5,0.5) --- mapping to the screen coordinate system is --- (screen coordinate x-axis * 0.5, screen coordinate y-axis * 0.5)

4. Yes, the viewport coordinates and screen coordinates are mutually mapped. The viewport to the screen is scaled up, and the screen to the viewport is scaled down.

1. The parameters required by the above APIs are all Vector3 objects (in the form of coordinates)

1. The coordinates of the upper right corner of the screen coordinate system are the above --- the x-axis coordinate is the width of the screen, and the y-axis coordinate is the height of the screen --- the method of obtaining the height and width is to call directly through the Screen class + point operator Static attributes width and height 

2. Modifying the screen coordinates of the object will not actually change the actual position of the object in the game scene. If we want to change the corresponding position of the object after modifying the screen coordinates of the object, we need to convert the modified screen coordinates It is the world coordinate, and then assign it to this.transform.position.

Guess you like

Origin blog.csdn.net/qq_51947882/article/details/130002060