{"id":1304,"date":"2020-04-02T17:02:17","date_gmt":"2020-04-02T08:02:17","guid":{"rendered":"http:\/\/yoonhada.com\/?p=1304"},"modified":"2023-12-26T23:56:34","modified_gmt":"2023-12-26T14:56:34","slug":"ngui-world-%ec%a2%8c%ed%91%9c%ea%b3%84-%ec%83%81%ed%98%b8-%eb%b3%80%ed%99%98","status":"publish","type":"post","link":"http:\/\/yoonhada.com\/?p=1304","title":{"rendered":"NGUI <-> World \uc88c\ud45c\uacc4 \uc0c1\ud638 \ubcc0\ud658"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"NGUI<-&gt;World\uc88c\ud45c\uacc4\uc0c1\ud638\ubcc0\ud658-1.World\uc88c\ud45c\uacc4-&gt;NGUI\uc88c\ud45c\uacc4\">1.&nbsp;World \uc88c\ud45c\uacc4 -&gt; NGUI \uc88c\ud45c\uacc4<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\uc0ac\uc6a9 \uc608\uc2dc : RPG \uc5d0\uc11c \uce90\ub9ad\ud130 \uba38\ub9ac \uc704\uc5d0 \ub530\ub77c\ub2e4\ub2c8\ub294 HP Bar \ub4f1<\/li><li>\ucc38\uace0 : World \uc88c\ud45c\uacc4\uc5d0\uc11c Viewport \uc88c\ud45c\uacc4\ub85c \uc911\uac04 \ubcc0\ud658\ud558\uace0 \ub098\uc11c \ub2e4\uc2dc NGUI \uc88c\ud45c\uacc4\ub85c \ubcc0\ud658\ud55c\ub2e4.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>UICamera.mainCamera.ViewportToWorldPoint (Camera.main.WorldToViewportPoint (worldPosition));<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"NGUI<-&gt;World\uc88c\ud45c\uacc4\uc0c1\ud638\ubcc0\ud658-2.NGUI\uc88c\ud45c\uacc4-&gt;World\uc88c\ud45c\uacc4\">2.&nbsp;NGUI \uc88c\ud45c\uacc4 -&gt;&nbsp;World \uc88c\ud45c\uacc4 &nbsp;<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\uc0ac\uc6a9 \uc608\uc2dc : \uce90\ub9ad\ud130 \uc544\uc774\ucf58 UI \uc5d0\uc11c \uc2e4\uc81c \uc6d4\ub4dc\uc0c1\uc758 \uce90\ub9ad\ud130 3D \ubaa8\ub378\uc5d0\uac8c \uc120\uc744 \uae0b\ub294\ub2e4.<\/li><li>\ucc38\uace0 : \uc704\uc640 \uac19\uc774 Viewport \uc88c\ud45c\uacc4 \ubcc0\ud658\uc774 \ud55c \ubc88 \uc788\uc5b4\uc57c \ud55c\ub2e4.<\/li><li>\uac00\uc7a5 \uc911\uc694\ud55c \ud3ec\uc778\ud2b8!<\/li><li>NGUI \uc88c\ud45c\uacc4\uc5d0\uc11c z\uac12\uc774 0 \uc778\ub370 \ud2b9\uc815 \uac12\uc744 \uaf2d \ub123\uc5b4\uc57c \ud55c\ub2e4.<\/li><li>\uadf8\ub807\uc9c0 \uc54a\uc73c\uba74 \ud56d\uc0c1 \uce74\uba54\ub77c \uc704\uce58\uac00 \ub098\uc624\uac8c \ub418\ubbc0\ub85c 2D-&gt;3D \uac00 \uc560\ucd08\uc5d0 \uc548\ub418\ub2c8 Ray \ub97c \uc3d8\uac70\ub098 \ubcf5\uc7a1\ud574\uc9c0\ub294\ub370<\/li><li>z\uac12\uc5d0 \uac12\uc744 \ub123\uac8c \ub418\uba74 \uac04\ub2e8\ud788 \ud574\uacb0!<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public static Vector3 NGUIToWorld(Vector3 nguiPosition)\n{\n    nguiPosition.z += 5f;\n    Vector3 worldPosition = Camera.main.ViewportToWorldPoint(UICamera.mainCamera.WorldToViewportPoint(nguiPosition));\n    return worldPosition;\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\n\n\ub9c8\uc6b0\uc2a4\uc758 \ud604\uc7ac \uc704\uce58\ub97c \uac00\uc838\uc624\uae30 \uc704\ud574 \uc0ac\uc6a9\ud558\ub294 Input.mousePosition\uc740 \uc2a4\ud06c\ub9b0 \uc88c\ud45c\uacc4\ub97c \uc0ac\uc6a9\ud55c\ub2e4.\ub530\ub77c\uc11c \uc774 \uc88c\ud45c\ub97c \uc6d4\ub4dc \uc88c\ud45c\ub85c \ubcc0\ud658\ud574\uc8fc\uae30 \uc704\ud574 \uc0ac\uc6a9\ud558\ub294 \uac83\uc774 Camera.ScreenToWorldPoint()\uc778\ub370,&nbsp;\ud55c\uac00\uc9c0 \uc8fc\uc758\ud574\uc57c\ud560 \uc810\uc774 \uc788\ub2e4.Input.mousePosition\uc758 z\uac12\uc774 \ud56d\uc0c1 0\uc774\ub77c\ub294 \uac83\uc774\ub2e4.\ub530\ub77c\uc11c Camera.main.ScreenToWorldPoint(Input.mousePosition)\uc744 \ud558\uac8c \ub418\uba74 \uadf8 \uacb0\uacfc\ub294 \uce74\uba54\ub77c\uc758 \uc6d4\ub4dc \uc88c\ud45c\uac12\uc774 \ub098\uc624\uac8c \ub41c\ub2e4.\uadf8\ub798\uc11c Input.mousePosition\uc744 \uadf8\ub300\ub85c \uc0ac\uc6a9\ud558\uba74 \uc548\ub418\uace0, z\uac12\uc744 \ubcc0\uacbd\ud574\uc900 \ub4a4\uc5d0 \uc0ac\uc6a9\ud574\uc57c \ud55c\ub2e4.\uc608\ub97c\ub4e4\uc5b4 \uc544\ub798\uc640 \uac19\uc774 \uc0ac\uc6a9\ud560 \uc218 \uc788\ub2e4.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Vector3 screenMouse = Input.mousePosition;screenMouse.z = Camera.main.WorldToScreenPoint(Vector3.zero).z;Vector3 worldMouse = Camera.main.ScreenToWorldPoint(screenMouse);<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">screenMouse\uc758 z \uac12\uc5d0 \ub300\uc785\ud55c \uac12\uc758 \uc815\uccb4\ub97c \uc0dd\uac01\ud574\ubcf4\uc790.\uc6d4\ub4dc \uc88c\ud45c\uacc4\uc758 \uc6d0\uc810(0, 0, 0)\uc744 \uc2a4\ud06c\ub9b0 \uc88c\ud45c\uacc4\ub85c \ubcc0\ud658\ud55c \uac12\uc774\ub2e4. \uc774\ub294 \uce74\uba54\ub77c\uc758 \uc704\uce58\uc5d0 \ub530\ub77c \ub2e4\ub978 \uac12\uc774 \ub420 \uc218 \uc788\uaca0\ub2e4.\uc5b4\uca0c\ub4e0 \uc774\ub807\uac8c \ud558\uba74 \ub9c8\uc6b0\uc2a4 \ud074\ub9ad\uc774 \uc6d4\ub4dc \uc88c\ud45c\uacc4\uc758 z\uac12 0\uc778 \uc704\uce58\uc5d0\uc11c\uc758 \ud074\ub9ad \uc9c0\uc810\uc774 \ub418\uaca0\ub2e4.&nbsp;<a href=\"https:\/\/conf.treenod.com\/pages\/viewpage.action?pageId=10848366\"><\/a><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.&nbsp;World \uc88c\ud45c\uacc4 -&gt; NGUI \uc88c\ud45c\uacc4 \uc0ac\uc6a9 \uc608\uc2dc : RPG \uc5d0\uc11c \uce90\ub9ad\ud130 \uba38\ub9ac \uc704\uc5d0 \ub530\ub77c\ub2e4\ub2c8\ub294 HP Bar \ub4f1 \ucc38\uace0 : World \uc88c\ud45c\uacc4\uc5d0\uc11c Viewport \uc88c\ud45c\uacc4\ub85c \uc911\uac04 \ubcc0\ud658\ud558\uace0 \ub098\uc11c \ub2e4\uc2dc NGUI \uc88c\ud45c\uacc4\ub85c \ubcc0\ud658\ud55c\ub2e4. UICamera.mainCamera.ViewportToWorldPoint (Camera.main.WorldToViewportPoint (worldPosition)); 2.&nbsp;NGUI \uc88c\ud45c\uacc4 -&gt;&nbsp;World \uc88c\ud45c\uacc4 &nbsp; \uc0ac\uc6a9 \uc608\uc2dc : \uce90\ub9ad\ud130 \uc544\uc774\ucf58 UI \uc5d0\uc11c \uc2e4\uc81c \uc6d4\ub4dc\uc0c1\uc758 \uce90\ub9ad\ud130 3D \ubaa8\ub378\uc5d0\uac8c \uc120\uc744 \uae0b\ub294\ub2e4. \ucc38\uace0 : \uc704\uc640 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[80,90],"tags":[42],"class_list":["post-1304","post","type-post","status-publish","format-standard","hentry","category-project","category-unity-project","tag-unity"],"_links":{"self":[{"href":"http:\/\/yoonhada.com\/index.php?rest_route=\/wp\/v2\/posts\/1304","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/yoonhada.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yoonhada.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yoonhada.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/yoonhada.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1304"}],"version-history":[{"count":1,"href":"http:\/\/yoonhada.com\/index.php?rest_route=\/wp\/v2\/posts\/1304\/revisions"}],"predecessor-version":[{"id":1305,"href":"http:\/\/yoonhada.com\/index.php?rest_route=\/wp\/v2\/posts\/1304\/revisions\/1305"}],"wp:attachment":[{"href":"http:\/\/yoonhada.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yoonhada.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1304"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yoonhada.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}