{"id":3294,"date":"2019-01-06T07:41:23","date_gmt":"2019-01-05T22:41:23","guid":{"rendered":"https:\/\/nantoka.filmm.info\/blog\/?p=3294"},"modified":"2019-01-07T18:38:10","modified_gmt":"2019-01-07T09:38:10","slug":"%e3%82%b2%e3%83%bc%e3%83%a0%e3%82%aa%e3%83%96%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e3%82%92%e5%b7%a1%e5%9b%9e%e3%81%95%e3%81%9b%e3%82%8b%ef%bc%88%ef%bd%81%ef%bd%89%e7%84%a1%e3%81%97%ef%bc%89","status":"publish","type":"post","link":"https:\/\/nantoka.filmm.info\/blog\/?p=3294","title":{"rendered":"\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5de1\u56de\u3055\u305b\u308b\uff08\uff21\uff29\u7121\u3057\uff09"},"content":{"rendered":"\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u30a2\u30b5\u30a4\u30f3\u3055\u308c\u305f\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u6bce\u56de\u6c7a\u307e\u3063\u305f\u30eb\u30fc\u30c8\u3092\u5de1\u56de\u3055\u305b\u307e\u3059\uff0e<br><\/p>\n\n\n\n<p>\u4e0b\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092Patrol.cs\u3068\u3057\u3066\u4fdd\u5b58\u3057Unity\u306b\u8aad\u307f\u8fbc\u307f\u307e\u3059\uff0e<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nusing UnityEngine;\nusing System.Collections;\n\npublic class Patrol : MonoBehaviour\n{\n\n    &#x5B;SerializeField, TooltipAttribute(&quot;\u7d4c\u7531\u5730\u70b9\u306e\u6570\u3092\u5165\u529b\u3057\uff0c\u30b7\u30fc\u30f3\u4e0a\u306b\u914d\u7f6e\u3057\u305f\u7a7a\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30a2\u30b5\u30a4\u30f3\u3057\u307e\u3059&quot;)]\n    public Transform&#x5B;] wayPoints;\n\n    public Transform target;\n    public float speed;\n\n    public int currentRoot;\n\n\n    void Update()\n    {\n\n        \/\/\u914d\u5217\u306b\u5165\u308c\u305fTransform\u3092\u9806\u306b\u5de1\u308b\uff0eAI\u3092\u4f7f\u3063\u3066\u3044\u308c\u3070\u30b9\u30e0\u30fc\u30ba\u306b\u66f2\u304c\u308b\u304c\u3053\u308c\u306f\u92ed\u89d2\u306b\u66f2\u304c\u308b\n\n        float step = speed * Time.deltaTime;\n        transform.position = Vector3.MoveTowards(transform.position, wayPoints&#x5B;currentRoot].position, step);\n\n\n        Vector3 pos = wayPoints&#x5B;currentRoot].position;\n\n        float test = Vector3.Distance(target.position, pos);\n        transform.LookAt(pos);\n                    \n        if(Vector3.Distance(transform.position, pos) &lt; 0.5f)\n        {\n          currentRoot = (currentRoot &lt; wayPoints.Length - 1) ? currentRoot + 1 : 0;\n        }\n\n    }\n}\n<\/pre><\/div>\n\n\n<p>\u30b7\u30fc\u30f3\u5185\u306b\u5de1\u56de\u3059\u308bGameObject\u3092\u914d\u7f6e\u3057\u307e\u3059\uff0e<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"314\" height=\"152\" src=\"https:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2019\/01\/cube.jpg\" alt=\"\" class=\"wp-image-3300\" srcset=\"https:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2019\/01\/cube.jpg 314w, https:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2019\/01\/cube-300x145.jpg 300w\" sizes=\"auto, (max-width: 314px) 100vw, 314px\" \/><figcaption>\u56f3\u3067\u306fCube\u3092\u9078\u629e\u3057\u3066\u3044\u307e\u3059<\/figcaption><\/figure><\/div>\n\n\n\n<p>\u3053\u306eGameObject\u306bPatrol.cs\u3092\u30a2\u30b5\u30a4\u30f3\u3057\u307e\u3059\uff0e<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2019\/01\/patrolinspec.jpg\" alt=\"\" class=\"wp-image-3307\" width=\"394\" height=\"161\" srcset=\"https:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2019\/01\/patrolinspec.jpg 816w, https:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2019\/01\/patrolinspec-300x124.jpg 300w, https:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2019\/01\/patrolinspec-768x316.jpg 768w\" sizes=\"auto, (max-width: 394px) 100vw, 394px\" \/><\/figure><\/div>\n\n\n\n<p>Size\u306f\u5de1\u56de\u7b87\u6240\u306e\u6570\u3067\uff0c\u3053\u3053\u306b\u6570\u5b57\u3092\u5165\u308c\u308b\u3068\u4e0b\u306b\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u304c\u73fe\u308c\u307e\u3059\uff0eSpeed\u306b\u306f\u9069\u5f53\u306a\u6570\u5b57\u3092\u5165\u308c\u3066\u304a\u304d\u307e\u3059\uff0e<\/p>\n\n\n\n<p>Element\u306b\u306f\u3000GameObject\uff1eCreateEmpty\u3067\u4f5c\u6210\u3057\u305f\u7a7a\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff08\u4f4d\u7f6e\u60c5\u5831\u306e\u307f\uff09\u3092\u914d\u7f6e\u3044\u308c\u307e\u3059\uff0e<\/p>\n\n\n\n<p>\u3053\u308c\u3067\u518d\u751f\u3059\u308b\u3068\uff0cPatrol.cs\u3092\u30a2\u30b5\u30a4\u30f3\u3057\u305fGameObject\u304cWayPoints\u3092\u5de1\u56de\u3059\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\uff0e<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2019\/01\/6879a1cbf4d581ff0205deef6fe91b77.mp4\"><\/video><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u30a2\u30b5\u30a4\u30f3\u3055\u308c\u305f\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u6bce\u56de\u6c7a\u307e\u3063\u305f\u30eb\u30fc\u30c8\u3092\u5de1\u56de\u3055\u305b\u307e\u3059\uff0e \u4e0b\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092Patrol.cs\u3068\u3057\u3066\u4fdd\u5b58\u3057Unity\u306b\u8aad\u307f\u8fbc\u307f\u307e\u3059\uff0e \u30b7\u30fc\u30f3\u5185\u306b\u5de1\u56de\u3059\u308bGameObject\u3092\u914d\u7f6e\u3057\u307e\u3059\uff0e \u3053\u306eGam &hellip; <a href=\"https:\/\/nantoka.filmm.info\/blog\/?p=3294\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5de1\u56de\u3055\u305b\u308b\uff08\uff21\uff29\u7121\u3057\uff09<\/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],"tags":[],"class_list":["post-3294","post","type-post","status-publish","format-standard","hentry","category-c","category-unity"],"_links":{"self":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3294","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=3294"}],"version-history":[{"count":25,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3294\/revisions"}],"predecessor-version":[{"id":3348,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3294\/revisions\/3348"}],"wp:attachment":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}