且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

查找像素的精灵在Unity

更新时间:2023-02-26 15:15:12

它工作在3D,因为 RaycastHit.textureCoord 需要一个网格对撞机。在2D情况下,它是这样simplee,因为你可以自己计算出的位置,你知道精灵命中,精灵的光标位置和大小。

It works in 3D because RaycastHit.textureCoord requires a mesh collider. In the 2D case it is way simplee because you can calculate the position yourself as you know the sprite hit, the cursor position and size of the sprite.