What EXACTLY is world space and screen space? (Converting units)
[2024-02-25 08:58:47]
Screen space is the space defined by the screen. This means that in screen space, the coordinates are 2d, (0,0) is the lower left corner (presumably the upper left corner, not remembered), which is the upper right corner of (screen.width, screen.height). These are pixel coordinates. Mouse position is given in this coordinate system
World space is the space in which the object is located. They have 3D coordinates. Worldspace size is not limited. It extends from (infinity, infinity, infinity) to (infinity, infinity, infinity). Objects and cameras can be placed anywhere in this space. Unit size of world space is arbitrary
The camera maps world space to screen space. Render the project coordinates of the world space as a screen in a two-dimensional plane. Therefore, if you want to convert the position of the world to the position of the screen (and vice versa), you need to use the camera. The camera has a setting that determines the projection method of coordinates. These settings basically determine the size of the world space unit in the screen space.
If you are using a 2D camera (ie orthographic), the camera's orthorectification will determine the visible size of the camera. If set to half the height of the screen, one pixel will be fully mapped to one unit. To calculate the position of the world, it is simple camera.position + ((screen space position - center of screen) / screen height / 2 * orthogonal size). For example, if (0, 0, 0) + ((400, 400) - (400, 300) and (400, 400) and the resolution of the camera are 0, 0, 0, the resolution of the screen is 800, 600 and the size of the orthophoto is 10, )) / (800) / 10) = (0, 0, 0) + ((0, 100) / 400 * 10) = (0, 0, 0) + (0, 2.5). Therefore, (400, 400) screen coordinates are mapped to these camera settings (0, 2.5).
However, 3D cameras are not easy. To find the position of the world from the 2D screen position, you need to reverse the projection. But there is not enough data. When projecting, enter the 2D position using the depth information from the 3D position. However, if there is only a 2D position (such as mousePosition), you do not know how much you need to move to that position, so it is mapped to a 3D line (depth information). In order to acquire a point, not a line, you need to provide depth information yourself
Now, the unity makes it very easy by providing you some functions for you to convert. For example, Camera.ScreenToWorldPoint and Camera.ScreenPointToRay. In 2D, you only need to convert it to a point in the world space using Camera.ScreenToWorldPoint. Since the output of x, y is the same regardless of depth, you do not need to specify z value at the input point. In 3D, you must use ScreenToWorldPoint to specify the z value (z is always the camera position) to select the position of the front of the camera. Alternatively, use ScreenPointToRay to output light (the origin of camera position and direction). This can be used to find objects under the cursor in ray casting.
Space In any library with any kind of free compartment space you can create private breastfeeding spaces with just a few changes such as curtains and screens. In larger libraries, empty offices can be turned into breastfeeding spaces according to the needs of employees and the public. The corners of the staff lounge can also be screened to make private space. Local libraries may consider sharing space with employees working in neighboring SMEs and may even provide space for local breastfeeding mothers' groups. Breastfeeding Child care spaces should not be in the toilet. Details of what the employer should know about the law concerning the lactation time of lactating women
Prior to UNISPACE + 50, the World Space Week Association (WSWA) and the United Nations Space Agency (UNOOSA) invited volunteers from the World Space Week to participate in the paper competition on the role of the present and the future space and society . Participants are asked to ask three questions.
So, if you