{"id":2567,"date":"2017-10-23T15:58:09","date_gmt":"2017-10-23T06:58:09","guid":{"rendered":"http:\/\/nantoka.filmm.info\/blog\/?p=2567"},"modified":"2018-12-12T19:12:56","modified_gmt":"2018-12-12T10:12:56","slug":"%e3%82%bf%e3%83%83%e3%83%97%e3%81%97%e3%81%9f%e4%bd%8d%e7%bd%ae%e3%81%ab%e7%a7%bb%e5%8b%95","status":"publish","type":"post","link":"https:\/\/nantoka.filmm.info\/blog\/?p=2567","title":{"rendered":"\u30bf\u30c3\u30d7\u3057\u305f\u4f4d\u7f6e\u306b\u79fb\u52d5"},"content":{"rendered":"<p>\u52d5\u753b\u306e\u3088\u3046\u306a\u52d5\u304d\u3092\u5b9f\u73fe\u3057\u307e\u3059<\/p>\n<p>2017\/11\/02\u66f4\u65b0\uff0c\u6b21\u3005\u30bf\u30c3\u30d7\u3057\u3066\u30b4\u30fc\u30eb\u3092\u3069\u3093\u3069\u3093\u5909\u66f4\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u305f<\/p>\n<p><a href=\"http:\/\/filmm.info\/unity\/edukit3.unitypackage\">\u3053\u3053<\/a>\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059<\/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-2567-1\" width=\"474\" height=\"335\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"http:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2017\/10\/tapMove.mp4?_=1\" \/><a href=\"http:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2017\/10\/tapMove.mp4\">http:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2017\/10\/tapMove.mp4<\/a><\/video><\/div>\n<pre class=\"lang:default decode:true\" title=\"tapMove.cs\">using UnityEngine;\nusing System.Collections;\nusing System;\n\npublic class tapMove : MonoBehaviour {\n\n\t\/\/AI\u306e\u5909\u6570\u7528\n\tUnityEngine.AI.NavMeshAgent agent;\n\n\t\/\/hit\u60c5\u5831\uff08\u30bf\u30c3\u30d7\u5148\uff09\u60c5\u5831\u306e\u683c\u7d0d\u7528\n\tRaycastHit hit;\n\n\t\/\/\u30bf\u30c3\u30d7\u7528\u30ec\u30a4\u306e\u6e96\u5099\n\tRay ray;\n\n\t[SerializeField, HeaderAttribute (\"circlePrefab\u3092\u3053\u3053\u306b\u30a2\u30b5\u30a4\u30f3\")]\n\tpublic GameObject circlePre;\n\n\t\/\/\u30ec\u30a4\u30e4\u30fc\u30de\u30b9\u30af\u3067\u30bf\u30c3\u30d7\u3092\u7121\u8996\u3059\u308b\u30ec\u30a4\u30e4\u30fc\u8a2d\u5b9a\u7528\n\tLayerMask mylayerMask;\n\n\t\/\/\u30a2\u30cb\u30e1\u30fc\u30bf\u30fc\u306e\u5909\u6570\u7528\n\tAnimator animator;\n\n\n\t\/\/\u521d\u671f\u5316\n\tvoid Start () {\n\t\tagent = GetComponent&lt;UnityEngine.AI.NavMeshAgent&gt;();\/\/AI\u3092\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u3042\u308b\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304b\u3089\u63a2\u3059\n\t\tanimator = GetComponent&lt;Animator&gt; ();\/\/\u3053\u306e\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304b\u3089\u30a2\u30cb\u30e1\u30fc\u30bf\u30fc\u3092\u63a2\u3059\n\t\tint layerMask = LayerMask.GetMask(new string[] {\"Default\"});\/\/\u30ec\u30a4\u30e4\u30fc\u30de\u30b9\u30af\u306e\u8a2d\u5b9a\n\t\tmylayerMask = layerMask;\/\/\u3053\u308c\u4f55\u3060\u3063\u3051\uff1f\n\t}\n\n\n\t\/\/\u6bce\u56de\u51e6\u7406\u3057\u307e\u3059\n\tvoid Update () {\n\n\t\n\t\t\t\/\/ \u5de6\u30af\u30ea\u30c3\u30af\u3057\u305f\u3068\u304d\u306b\u3001\n\t\t\tif (Input.GetMouseButtonDown (0)) {\n\t\t\t\t\/\/ \u30de\u30a6\u30b9\u306e\u4f4d\u7f6e\u304b\u3089Ray\u3092\u767a\u5c04\u3057\u3066\u3001\n\t\t\t\tray = Camera.main.ScreenPointToRay (Input.mousePosition);\n\t\t\t\t\/\/ \u7269\u4f53\u306b\u3042\u305f\u3063\u305f\u3089\u3001\n\t\t\tif (Physics.Raycast (ray, out hit, 30f, mylayerMask)) {\n\t\t\t\t\t\/\/ \u305d\u306e\u5834\u6240\u306b\u3001Nav Mesh Agent\u3092\u30a2\u30bf\u30c3\u30c1\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u79fb\u52d5\u3055\u305b\u308b\n\t\t\t\t\tagent.SetDestination (hit.point);\n\n\t\t\t\t\t\/\/ \"Run\"\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306b\u9077\u79fb\n\t\t\t\t\t\/\/\tanimator.SetBool (\"Wak\", true);\n\t\t\t\t\tspawnPrefab ();\n\t\t\t\t}       \n\n\n\t\t}\n\t\t\/\/ \u76ee\u7684\u5730\u3068\u30d7\u30ec\u30a4\u30e4\u30fc\u3068\u306e\u8ddd\u96e2\u304c1\u4ee5\u4e0b\u306b\u306a\u3063\u305f\u3089\u3001\n\t\tif (Vector3.Distance(hit.point, transform.position) &lt; 1.0f) {\n\n\t\t}\n\t}\n\n\t\/\/\u30bf\u30fc\u30b2\u30c3\u30c8\u30de\u30fc\u30ab\u30fc\u3092\u8868\u793a\n\tvoid spawnPrefab(){\n\n\t\tstring delPreviusGO = circlePre.name;\/\/Prefab\u306e\u540d\u524d\u3092\u53d6\u5f97\u3059\u308b\n\t\ttry{\n\t\tGameObject deathObj =  GameObject.Find (delPreviusGO);\/\/Prefab\u540d\u306e\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u3042\u3063\u305f\u3089\n\t\t\tDestroy(deathObj);\/\/\u305d\u308c\u3092\u6d88\u3059\uff1d\u3064\u307e\u308a\u76ee\u7684\u5730\u306b\u5230\u7740\u524d\u306b\u30bf\u30c3\u30d7\u3057\u3066\u884c\u304d\u5148\u3092\u5909\u66f4\u3057\u305f\u6642\u7528\n\t\t}catch(NullReferenceException e) {\/\/\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u6642\u306e\u51e6\u7406\uff08\u7279\u306b\u4f55\u3082\u3057\u3066\u3044\u306a\u3044\uff09\n\t\t\tDebug.Log (\"noGO\");\n\t\t}\n\n\t\tVector3 mypos ;\/\/\u884c\u304d\u5148\u306e\u5ea7\u6a19\u8a2d\u5b9a\u7528\n\t\tfloat myPosy = hit.point.y + 0.1f;\/\/\u82e5\u5e72\u9ad8\u3044\u4f4d\u7f6e\u306b\u30de\u30fc\u30ab\u30fc\u8868\u793a\u3055\u305b\u308b\n\t\tmypos = new Vector3 (hit.point.x, myPosy, hit.point.z);\/\/Y\u3060\u3051\u5c11\u3057\u9ad8\u304f\u3057\u305f\u5ea7\u6a19\u4f5c\u6210\n\t\tGameObject circleGO = Instantiate(circlePre, mypos, circlePre.transform.rotation) as GameObject;\/\/Prefab\u3092\u751f\u6210\u3059\u308b\n\t\tcircleGO.name = circlePre.name;\/\/Prefab\u3067\u306a\u304f\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u3057\u3066\u540d\u524d\u3092\u8a2d\u5b9a\u3059\u308b\uff08\u4e0a\u3067\u540d\u524d\u3067\u691c\u7d22\u3057\u3066\u6d88\u3059\u305f\u3081\u306b\u8a2d\u5b9a\u3044\u3066\u3044\u308b\uff09\n\n\t}\n\n\n}<\/pre>\n<p>\u5143\u30cd\u30bf\u306f<a href=\"http:\/\/megumisoft.hatenablog.com\/entry\/2015\/05\/27\/010555\">\u3053\u3061\u3089<\/a>\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u53c2\u8003\u306b\u3057\u3066\u3044\u307e\u3059<\/p>\n<p>\u307e\u305f\uff0cPrefab\u5074\u306b\u306f\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u3042\u3066\u3066\uff0cIsTrigger\u3092ON\u306b\u3057\u3066\u3044\u307e\u3059<\/p>\n<pre class=\"lang:default decode:true \" title=\"triggerDestroy\">using System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\n\npublic class triggerDestroy : MonoBehaviour {\n\tAnimation anim;\n\tbool animCheck;\n\t\/\/ Use this for initialization\n\tvoid Start () {\n\t\tanim = gameObject.GetComponent&lt;Animation&gt; ();\n\t\tanimCheck = false;\/\/noPlayning\n\t}\n\t\n\t\/\/ Update is called once per frame\n\tvoid Update () {\n\t\tif (animCheck) {\n\t\t\tif (!anim.isPlaying) {\n\t\t\t\tprint (\"end\");\n\t\t\t\tanimCheck = false;\/\/noanimPlay\n\t\t\t\tDestroy(this.gameObject);\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\tvoid OnTriggerEnter(Collider other) {\n\t\t\/\/Debug.Log (\"ON\");\n\t\tif (!anim.isPlaying) {\n\t\tanim.Play ();\n\t\tanimCheck = true;\/\/Playing\n\t\t}\n\n\t}\n\n\n}\n<\/pre>\n<p>\u30bf\u30fc\u30b2\u30c3\u30c8\u306e\u8d64\u3044\u8f2a\u306fPhotoshop\u3067\u4f5c\u6210\u3057\uff0cPlane\u306b\u30c6\u30af\u30b9\u30c1\u30e3\u3067\u8cbc\u4ed8<\/p>\n<p>\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\uff08<a href=\"http:\/\/filmm.info\/unity\/edukit3.unitypackage\">\u3053\u3053<\/a>\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u52d5\u753b\u306e\u3088\u3046\u306a\u52d5\u304d\u3092\u5b9f\u73fe\u3057\u307e\u3059 2017\/11\/02\u66f4\u65b0\uff0c\u6b21\u3005\u30bf\u30c3\u30d7\u3057\u3066\u30b4\u30fc\u30eb\u3092\u3069\u3093\u3069\u3093\u5909\u66f4\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u305f \u3053\u3053\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059 using UnityEngine; using System.Collectio &hellip; <a href=\"https:\/\/nantoka.filmm.info\/blog\/?p=2567\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">\u30bf\u30c3\u30d7\u3057\u305f\u4f4d\u7f6e\u306b\u79fb\u52d5<\/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,50],"tags":[],"class_list":["post-2567","post","type-post","status-publish","format-standard","hentry","category-c","category-unity","category-48","category-47","category-50"],"_links":{"self":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2567","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=2567"}],"version-history":[{"count":6,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2567\/revisions"}],"predecessor-version":[{"id":3262,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2567\/revisions\/3262"}],"wp:attachment":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}