首先,unity2d中的camera有四大坐标系你需要了解清楚:
官方对unity camera的描述:
Description
A Camera is a device through which the player views the world.
A screen space point is defined in pixels. The bottom-left of the screen is (0,0); the right-top is (pixelWidth,pixelHeight). The z position is in world units from the camera.
A viewport space point is normalized and relative to the camera. The bottom-left of the camera is (0,0); the top-right is (1,1). The
本文详细解析Unity 2D中的四大坐标系,包括屏幕空间、视口空间、世界空间和GUI坐标系,并重点讲解如何从世界坐标转换到屏幕坐标,以及如何根据鼠标点击位置在Unity 2D场景中生成新物体。通过示例代码介绍了Unity的转换函数,如WorldToScreenPoint和ScreenToViewportPoint等。
最低0.47元/天 解锁文章
2394

被折叠的 条评论
为什么被折叠?



