{"id":25,"date":"2015-03-04T01:16:34","date_gmt":"2015-03-03T16:16:34","guid":{"rendered":"http:\/\/milennium9.godohosting.com\/wordpress\/?p=25"},"modified":"2015-03-04T01:16:34","modified_gmt":"2015-03-03T16:16:34","slug":"2d%ec%97%90%ec%84%9c-raycast%eb%a5%bc-%ed%86%b5%ed%95%9c-%ec%98%a4%eb%b8%8c%ec%a0%9d%ed%8a%b8-%ec%84%a0%ed%83%9d","status":"publish","type":"post","link":"http:\/\/milennium9.godohosting.com\/wordpress\/?p=25","title":{"rendered":"2D\uc5d0\uc11c Raycast\ub97c \ud1b5\ud55c \uc624\ube0c\uc81d\ud2b8 \uc120\ud0dd"},"content":{"rendered":"<p>Unity3D\uc5d0\uc11c 2D \ud658\uacbd\uc5d0\uc11c\uc758 Object \uc120\ud0dd\uc744 \uc704\ud55c \ubc29\ubc95\uc744 \uc18c\uac1c\ud569\ub2c8\ub2e4.<\/p>\n<pre class=\"lang:c# decode:true \" title=\"Raycast2D\">    void Update() {\r\n        if (Input.GetMouseButtonDown(0))\r\n        {\r\n            Vector2 wp = Camera.main.ScreenToWorldPoint(Input.mousePosition);\r\n            Ray2D ray = new Ray2D(wp, Vector2.zero);\r\n            RaycastHit2D[] hits = Physics2D.RaycastAll(ray.origin, ray.direction);\r\n\r\n            foreach (var hit in hits)\r\n            {\r\n                if (!hit.collider.gameObject.CompareTag(\"Coin\"))\r\n                    continue;\r\n\r\n                GameObject can = hit.collider.gameObject;\r\n\r\n                can.GetComponent&lt;Animator&gt;().SetTrigger(\"Disapear\");\r\n            }\r\n        }\r\n    }<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Unity3D\uc5d0\uc11c 2D \ud658\uacbd\uc5d0\uc11c\uc758 Object \uc120\ud0dd\uc744 \uc704\ud55c \ubc29\ubc95\uc744 \uc18c\uac1c\ud569\ub2c8\ub2e4. void Update() { if (Input.GetMouseButtonDown(0)) { Vector2 wp = Camera.main.ScreenToWorldPoint(Input.mousePosition); Ray2D ray = new Ray2D(wp, Vector2.zero); RaycastHit2D[] hits = Physics2D.RaycastAll(ray.origin, ray.direction); foreach (var hit in hits) { if (!hit.collider.gameObject.CompareTag(&#8220;Coin&#8221;)) continue; GameObject can = hit.collider.gameObject; can.GetComponent&lt;Animator&gt;().SetTrigger(&#8220;Disapear&#8221;); } } } &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0},"categories":[3],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5PypW-p","_links":{"self":[{"href":"http:\/\/milennium9.godohosting.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/25"}],"collection":[{"href":"http:\/\/milennium9.godohosting.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/milennium9.godohosting.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/milennium9.godohosting.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/milennium9.godohosting.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=25"}],"version-history":[{"count":1,"href":"http:\/\/milennium9.godohosting.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":26,"href":"http:\/\/milennium9.godohosting.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/25\/revisions\/26"}],"wp:attachment":[{"href":"http:\/\/milennium9.godohosting.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/milennium9.godohosting.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/milennium9.godohosting.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}