Categories: Unity, C #, VS2015
Date Created: 2016-04-20 I. INTRODUCTION
In the virtual game world, the mathematical knowledge associated with 3D determines how the game engine calculates and simulates every frame the developer and the player sees. Learning or thinking about the basics of 3D math can help developers get a deeper understanding of the game engine. Second, coordinate system
In game development, a different coordinate system is often used to describe the position in the space, and the commonly used coordinate systems are:
1. World coordinate system
A datum used to describe the position and orientation of all objects in a game scene, also known as the global coordinate system.
2. Local coordinate system (locally)
Each object has its own object coordinate system, and the same movement or rotation with the object, also known as the model coordinate system or object coordinate system.
The grid model (mesh) holds the coordinates of the vertex coordinates in the local coordinate system.
3. Camera coordinate system (cameras)
A coordinate system based on the observed position and direction. The coordinate system makes it easy to judge whether an object is in front of the camera and the order of occlusion between objects.
4. Screen coordinate system (screens)
This is a two-dimensional coordinate system built on the screen to describe the position of the pixel on the screen. That
The upper left corner of the screen is (0,0);
The x-axis is in the right direction (from left to right);
The y-axis is in the positive direction (top to bottom). Iii. conversions between different coordinate systems in unity
In Unity: The following methods of the transform component can be converted to a coordinate system:
Transform.transformpoint method: Converts a coordinate point from a local coordinate system to a world coordinate system.
Transform.inversetransformpont method: Converts a coordinate point from a local coordinate system to a world coordinate system.
Transform.transformdirection and transform.inversetransformdirection: used to convert vectors between the object coordinate system and the world coordinate system.
"Unity" 5.1 3D Coordinate system basics