유니티 C#
스프라이트 크기만큼 월드좌표 가져오는것
죽은쥐
2022. 11. 10. 11:13
출처: https://forum.unity.com/threads/check-the-x-and-y-length-of-a-sprite.229949/
Check the X and Y length of a sprite
Hi, is it possible to check the X and Y length of a sprite? Thanks
forum.unity.com
sprite.bounds.extents.x; //Distance to the right side, from your center point (오른쪽)
-sprite.bounds.extents.x //Distance to the left side (왼쪽)
sprite.bounds.extents.y //Distance to the top (위)
-sprite.bounds.extents.y //Distance to the bottom (아래)
위의 수치값은 스프라이트 크기의 절반값이므로 해당 스프라이트의 중앙값 + 해당값들을 더해주면 월드상 좌표가 나오는 상황
sprite.bounds.size 도 있음.