{"id":2528,"date":"2017-08-25T12:38:46","date_gmt":"2017-08-25T03:38:46","guid":{"rendered":"http:\/\/nantoka.filmm.info\/blog\/?p=2528"},"modified":"2017-08-25T13:29:43","modified_gmt":"2017-08-25T04:29:43","slug":"%e3%83%89%e3%83%a9%e3%83%83%e3%82%b0%e3%81%97%e3%81%a6%e4%bd%8d%e7%bd%ae%e6%b1%ba%e3%82%81","status":"publish","type":"post","link":"https:\/\/nantoka.filmm.info\/blog\/?p=2528","title":{"rendered":"\u30c9\u30e9\u30c3\u30b0\u3057\u3066\u4f4d\u7f6e\u6c7a\u3081"},"content":{"rendered":"<p>\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u81ea\u7531\u5ea7\u6a19\u306b\u79fb\u52d5\u3059\u308b<\/p>\n<p>\u5b9f\u969b\u306b\u306f\u6c7a\u307e\u3063\u305fMatrix\u306b\u30b9\u30ca\u30c3\u30d7\u3059\u308b\u3088\u3046\u306b\uff0c\u6570\u5024\u3092\u4e38\u3081\u305f\u307b\u3046\u304c\u6271\u3044\u3084\u3059\u3044<\/p>\n<p>\u305d\u306e\u969b\u306b\u4e0b\u306ePlane\u306b\u30b0\u30ea\u30c3\u30c9\u3092\u8868\u793a\u3055\u305b\uff0c\u305d\u306e\u30b0\u30ea\u30c3\u30c9\u3092\u5149\u3089\u305b\u308b\u306a\u3069\u306e\u5bfe\u51e6\u304c\u5fc5\u8981\u304b\u3069<\/p>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8<\/p>\n<pre class=\"lang:default decode:true \" title=\"dragPoint.cs\">using System.Collections;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\n\r\npublic class dragPoint : MonoBehaviour {\r\n\tRaycastHit hit;\r\n\tRay ray;\r\n\tVector3 currentPos;\/\/\u6700\u7d42\u4f4d\u7f6e\u4fdd\u5b58\u7528\u5909\u6570\r\n\r\n\r\n\tvoid OnMouseDown(){ \/\/\u30de\u30a6\u30b9\u30af\u30ea\u30c3\u30af\u958b\u59cb\u6642\u7528\r\n\t\tcurrentPos = this.transform.position;\/\/\u4e0a\u6607\u524d\u306e\u5024\u3092\u5165\u308c\u308b\r\n\t\tthis.transform.position = currentPos + new Vector3 (0f, 1f, 0f);\/\/Y\u8ef8\u306b\uff11\u3060\u3051\u4e0a\u6607\u3055\u305b\u308b\r\n\t\tcurrentPos = this.transform.position;\/\/\u4e0a\u6607\u3057\u305f\u5024\u3092\u5165\u308c\u308b\r\n\t}\r\n\r\n\tvoid OnMouseDrag(){\/\/\u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\u6642\r\n\r\n\t\tray = Camera.main.ScreenPointToRay(Input.mousePosition);\/\/\u30de\u30a6\u30b9\u30af\u30ea\u30c3\u30af\u30dd\u30b8\u30b7\u30e7\u30f3\u3092ray\u3067\u53d6\u5f97\u3059\u308b\r\n\t\tif (Physics.Raycast(ray, out hit, 100f)){\/\/ray\u304c\u5f53\u305f\u3063\u305f\u4f4d\u7f6e\u3092hit\u306b\u5165\u308c\u308b\r\n\t\t\tthis.transform.position = new Vector3 (hit.point.x, currentPos.y, hit.point.z);\/\/X\u3068Z\u5ea7\u6a19\u3060\u3051\u3092hit\u306e\u5ea7\u6a19\u306b\u3059\u308b\r\n\t\t\tcurrentPos = this.transform.position;\/\/\u6700\u7d42\u4f4d\u7f6e\u3092\u5909\u6570\u306b\u5165\u308c\u3066\u304a\u304f\r\n\t\t}  \r\n\r\n\t}\r\n\r\n\tvoid OnMouseUp(){\/\/\u30de\u30a6\u30b9\u30af\u30ea\u30c3\u30af\u7d42\u4e86\u6642\r\n\t\tthis.transform.position = currentPos - new Vector3 (0f, 1f, 0f);\/\/\u6700\u7d42\u4f4d\u7f6e\u304b\u3089Y\u8ef8\u306b1\u3060\u3051\u4e0b\u964d\u3055\u305b\u308b\r\n\t}\r\n}\r\n<\/pre>\n<p>\u8ffd\u8a18<\/p>\n<p>21\u884c\u76ee\u3092<\/p>\n<pre class=\"lang:default decode:true \">this.transform.position = new Vector3 (Mathf.Floor(hit.point.x), currentPos.y, Mathf.Floor(hit.point.z));\/\/<\/pre>\n<p>\u306e\u3088\u3046\u306bMathf.Floor\u3067\u5c0f\u6570\u70b9\u4ee5\u4e0b\u3092\u4e38\u3081\uff08\u5207\u308a\u6368\u3066\uff09\u308b\u3068\uff0c1m\u5358\u4f4d\u3067\u52d5\u304d\u307e\u3059<\/p>\n<p>&nbsp;<\/p>\n<p>\u5b9f\u884c\u7d50\u679c<\/p>\n<div style=\"width: 474px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-2528-1\" width=\"474\" height=\"267\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"http:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2017\/08\/iShowU-Capture2.mp4?_=1\" \/><a href=\"http:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2017\/08\/iShowU-Capture2.mp4\">http:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2017\/08\/iShowU-Capture2.mp4<\/a><\/video><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u81ea\u7531\u5ea7\u6a19\u306b\u79fb\u52d5\u3059\u308b \u5b9f\u969b\u306b\u306f\u6c7a\u307e\u3063\u305fMatrix\u306b\u30b9\u30ca\u30c3\u30d7\u3059\u308b\u3088\u3046\u306b\uff0c\u6570\u5024\u3092\u4e38\u3081\u305f\u307b\u3046\u304c\u6271\u3044\u3084\u3059\u3044 \u305d\u306e\u969b\u306b\u4e0b\u306ePlane\u306b\u30b0\u30ea\u30c3\u30c9\u3092\u8868\u793a\u3055\u305b\uff0c\u305d\u306e\u30b0\u30ea\u30c3\u30c9\u3092\u5149\u3089\u305b\u308b\u306a\u3069\u306e\u5bfe\u51e6\u304c\u5fc5\u8981\u304b\u3069 \u30b9\u30af\u30ea\u30d7\u30c8 us &hellip; <a href=\"https:\/\/nantoka.filmm.info\/blog\/?p=2528\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">\u30c9\u30e9\u30c3\u30b0\u3057\u3066\u4f4d\u7f6e\u6c7a\u3081<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,2,48,47],"tags":[],"class_list":["post-2528","post","type-post","status-publish","format-standard","hentry","category-c","category-unity","category-48","category-47"],"_links":{"self":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2528","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2528"}],"version-history":[{"count":3,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2528\/revisions"}],"predecessor-version":[{"id":2536,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2528\/revisions\/2536"}],"wp:attachment":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2528"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}