{"id":2569,"date":"2020-12-15T23:10:09","date_gmt":"2020-12-15T14:10:09","guid":{"rendered":"https:\/\/obenkyolab.com\/?p=2569"},"modified":"2022-02-14T06:57:33","modified_gmt":"2022-02-13T21:57:33","slug":"%e3%80%90unity%e3%80%91%e3%82%ad%e3%83%a3%e3%83%a9%e3%82%af%e3%82%bf%e3%83%bc%e3%81%ab%e6%8a%9c%e5%88%80%e3%81%95%e3%81%9b%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/obenkyolab.com\/?p=2569","title":{"rendered":"\u3010Unity\u3011\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u306b\u629c\u5200\u3055\u305b\u308b\u65b9\u6cd5"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/obenkyolab.com\/?p=2569\/#%E6%A6%82%E8%A6%81\" >\u6982\u8981<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/obenkyolab.com\/?p=2569\/#%E5%AE%8C%E6%88%90%E3%82%A4%E3%83%A1%E3%83%BC%E3%82%B8\" >\u5b8c\u6210\u30a4\u30e1\u30fc\u30b8<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/obenkyolab.com\/?p=2569\/#Step1_%E5%BF%85%E8%A6%81Asset%E3%81%AE%E6%BA%96%E5%82%99\" >Step1 : \u5fc5\u8981Asset\u306e\u6e96\u5099<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/obenkyolab.com\/?p=2569\/#%E5%88%80%E3%81%AE%E5%85%A5%E6%89%8B\" >\u5200\u306e\u5165\u624b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/obenkyolab.com\/?p=2569\/#%E6%8A%9C%E5%88%80%E3%82%A2%E3%83%8B%E3%83%A1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%85%A5%E6%89%8B\" >\u629c\u5200\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u5165\u624b<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/obenkyolab.com\/?p=2569\/#Step2_%E6%8A%9C%E5%88%80%E3%81%95%E3%81%9B%E3%82%8B%E6%96%B9%E5%BC%8F\" >Step2 : \u629c\u5200\u3055\u305b\u308b\u65b9\u5f0f<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/obenkyolab.com\/?p=2569\/#%E3%82%A2%E3%83%8B%E3%83%A1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%86%8D%E7%94%9F\" >\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u518d\u751f<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/obenkyolab.com\/?p=2569\/#%E5%88%80%E3%81%AE%E7%A7%BB%E5%8B%95\" >\u5200\u306e\u79fb\u52d5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/obenkyolab.com\/?p=2569\/#Step3_%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88\" >Step3 : \u30b9\u30af\u30ea\u30d7\u30c8<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"\u6982\u8981\"><span class=\"ez-toc-section\" id=\"%E6%A6%82%E8%A6%81\"><\/span>\u6982\u8981<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Unity\u3067\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u306b\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u3051\u3066\u5263\u3092\u629c\u5200\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u5b8c\u6210\u30a4\u30e1\u30fc\u30b8\"><span class=\"ez-toc-section\" id=\"%E5%AE%8C%E6%88%90%E3%82%A4%E3%83%A1%E3%83%BC%E3%82%B8\"><\/span>\u5b8c\u6210\u30a4\u30e1\u30fc\u30b8<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u80cc\u4e2d\u306b\u3064\u3051\u305f\u5200\u3092\u9798\u304b\u3089\u629c\u304d\u3001\u307e\u305f\u5143\u306b\u623b\u3059\u307e\u3067\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"318\" height=\"332\" src=\"https:\/\/obenkyolab.com\/wp-content\/uploads\/2020\/12\/Battou-min.gif\" alt=\"\" class=\"wp-image-2571\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step1-\u5fc5\u8981asset\u306e\u6e96\u5099\"><span class=\"ez-toc-section\" id=\"Step1_%E5%BF%85%E8%A6%81Asset%E3%81%AE%E6%BA%96%E5%82%99\"><\/span>Step1 : \u5fc5\u8981Asset\u306e\u6e96\u5099<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u5200\u306e\u5165\u624b\"><span class=\"ez-toc-section\" id=\"%E5%88%80%E3%81%AE%E5%85%A5%E6%89%8B\"><\/span>\u5200\u306e\u5165\u624b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u307e\u305a\u306f\u809d\u5fc3\u306e\u5200\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092UnityAsset\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002\u3069\u3093\u306a\u3082\u306e\u3067\u3082\u3044\u3044\u3067\u3059\u304c\u3001\u5263\u3068\u9798\u304c\u30bb\u30c3\u30c8\u306b\u306a\u3063\u3066\u3044\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u4f7f\u3044\u3084\u3059\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u4eca\u56de\u306f\u4ee5\u4e0b\u306e\u30a2\u30bb\u30c3\u30c8\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/assetstore.unity.com\/packages\/3d\/props\/weapons\/free-katana-and-scabbard-67185\">https:\/\/assetstore.unity.com\/packages\/3d\/props\/weapons\/free-katana-and-scabbard-67185<\/a><\/p>\n\n\n\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066Unity\u3078\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u629c\u5200\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u5165\u624b\"><span class=\"ez-toc-section\" id=\"%E6%8A%9C%E5%88%80%E3%82%A2%E3%83%8B%E3%83%A1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%85%A5%E6%89%8B\"><\/span>\u629c\u5200\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u5165\u624b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u629c\u5200\u3059\u308b\u305f\u3081\u306eAnimation\u306f\u3044\u3064\u3082\u304a\u4e16\u8a71\u306b\u306a\u3063\u3066\u3044\u308bMixamo\u304b\u3089\u53d6\u5f97\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002Fantasy\u30b7\u30ea\u30fc\u30ba\u304b\u3089 Draw A Great Sword 1\u3068\u3044\u3046\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002\u3053\u308c\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3001Unity\u3078\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/www.mixamo.com\/#\/?genres=Fantasy&amp;page=1&amp;type=Motion%2CMotionPack\">https:\/\/www.mixamo.com\/#\/?genres=Fantasy&amp;page=1&amp;type=Motion%2CMotionPack<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step2-\u629c\u5200\u3055\u305b\u308b\u65b9\u5f0f\"><span class=\"ez-toc-section\" id=\"Step2_%E6%8A%9C%E5%88%80%E3%81%95%E3%81%9B%E3%82%8B%E6%96%B9%E5%BC%8F\"><\/span>Step2 : \u629c\u5200\u3055\u305b\u308b\u65b9\u5f0f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u518d\u751f\"><span class=\"ez-toc-section\" id=\"%E3%82%A2%E3%83%8B%E3%83%A1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%86%8D%E7%94%9F\"><\/span>\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u518d\u751f<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u518d\u751f\u306b\u306fSimpleAnimation\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>SimpleAnimation\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u306f\u3053\u3061\u3089\u3067\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u53c2\u8003\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-it-learning wp-block-embed-it-learning\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"BDf1bjTE2T\"><a href=\"https:\/\/obenkyolab.com\/?p=2260\">\u3010Unity\u3011\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u306bSimpleAnimation\u3067\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u3051\u308b<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;\u3010Unity\u3011\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u306bSimpleAnimation\u3067\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u3051\u308b&#8221; &#8212; Obenkyolab\" src=\"https:\/\/obenkyolab.com\/?p=2260&#038;embed=true#?secret=AB5WNKrzbC#?secret=BDf1bjTE2T\" data-secret=\"BDf1bjTE2T\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u5200\u306e\u79fb\u52d5\"><span class=\"ez-toc-section\" id=\"%E5%88%80%E3%81%AE%E7%A7%BB%E5%8B%95\"><\/span>\u5200\u306e\u79fb\u52d5<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u629c\u5200\u306b\u304a\u3044\u3066\u306f\u5200\u306e\u79fb\u52d5\u65b9\u6cd5\u304c\u809d\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u4eca\u56de\u306f\u4ee5\u4e0b\u306e\u6d41\u308c\u3067\u5b9f\u73fe\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u5200\u306e\u9798\u3092\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u306e\u80cc\u4e2d\u306b\u914d\u7f6e\u3057\u3066\u304a\u304f\u3002<\/li><li>\u5200\u3092\u9798\u306e\u5b50\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066\u9798\u306e\u4e2d\u306b\u53ce\u3081\u3066\u304a\u304f\u3002<\/li><li>\u629c\u5200\u3059\u308b\u305f\u3081\u306e\u30dc\u30bf\u30f3\u304c\u304a\u3055\u308c\u305f\u3089\u629c\u5200\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u518d\u751f\u3059\u308b<\/li><li>\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u518d\u751f\u306b\u5408\u308f\u305b\u5200\u3092\u6301\u3061\u624b\u306e\u5b50\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u4ed8\u3051\u66ff\u3048\u308b<\/li><li>\u629c\u5200\u5b8c\u4e86<\/li><\/ol>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5200\u3092\u9798\u3078\u3057\u307e\u3046\u3068\u304d\u306f\u4e0a\u8a18\u306e\u52d5\u304d\u306e\u9006\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step3-\u30b9\u30af\u30ea\u30d7\u30c8\"><span class=\"ez-toc-section\" id=\"Step3_%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88\"><\/span>Step3 : \u30b9\u30af\u30ea\u30d7\u30c8<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u4ee5\u4e0b\u304c\u4e0a\u8a18\u3092\u5200\u306e\u79fb\u52d5\u3092\u884c\u3046\u305f\u3081\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-csharp\" data-lang=\"C#\"><code>using System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\n\npublic class Battou : MonoBehaviour\n{\n    \/\/ Start is called before the first frame update\n\n    [SerializeField] public bool isActivatedWeapon = false;\/\/\u629c\u5200\u5b8c\u4e86\u30d5\u30e9\u30b0\n    [SerializeField] public bool isDeactivatedWeapon = true;\/\/\u629c\u5200\u524d\u30d5\u30e9\u30b0\n    [SerializeField] public bool inTranWeapon = false;\/\/\u629c\u5200\u4e2d\u30d5\u30e9\u30b0\n\n    \/\/RigidBody\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5b9a\u7fa9\n    Rigidbody rb;\n\n    \/\/SimpleAnimation\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5b9a\u7fa9\n    SimpleAnimation simpleAnimation;\n\n    \/\/\u5200\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u683c\u7d0d\u7528\n    public GameObject weapon;\n    public GameObject swordPod;\n    public GameObject weaponOn;\n\n    \/\/\u5200\u306e\u4f4d\u7f6e\u59ff\u52e2\u683c\u7d0d\u7528\u30d9\u30af\u30c8\u30eb\n    Vector3 weaponOnPos;\n    Vector3 weaponOnRot;\n\n    \/\/ Start is called before the first frame update\n    void Start()\n    {\n        \/\/Rigidbody\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u53d6\u5f97\n        rb = this.GetComponent&lt;Rigidbody&gt;();\n\n        \/\/\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u306e\u56de\u8ee2\u6291\u6b62\n        rb.constraints = RigidbodyConstraints.FreezeRotation;\n\n        \/\/\u30b7\u30f3\u30d7\u30eb\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u53d6\u5f97\n        simpleAnimation = GetComponent&lt;SimpleAnimation&gt;();\n\n        \/\/\u89aa\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u53d6\u5f97\n        weaponOn = weapon.transform.parent.gameObject;\n\n        \/\/\u629c\u5200\u72b6\u614b\u306e\u4f4d\u7f6e\u3092\u8a18\u61b6\u3057\u3066\u304a\u304f\n        weaponOnPos = weapon.transform.localPosition;\n        weaponOnRot = weapon.transform.localEulerAngles;\n\n        \/\/swordPod\u72b6\u614b\u306e\u3068\u304d\u306e\u89aa\u5b50\u95a2\u4fc2\u306b\u5909\u66f4\u3057\u3001\u4e00\u65e6\u9798\u306b\u7d0d\u3081\u305f\u72b6\u614b\u306b\u3059\u308b\n        weapon.gameObject.transform.parent = swordPod.gameObject.transform;\n        weapon.gameObject.transform.localPosition = Vector3.zero;\n        weapon.gameObject.transform.localEulerAngles = Vector3.zero;\n        \n        \/\/\u629c\u5200\u524d\u30d5\u30e9\u30b0\u3092true\u306b\n        isDeactivatedWeapon = true;\n    }\n\n    \/\/ Update is called once per frame\n    void Update()\n    {\n        \/\/\u629c\u5200\u30dc\u30bf\u30f3\u304c\u62bc\u3055\u308c\u305f\u3068\u304d\n        if (Input.GetKey(KeyCode.A))\n        {\n            \/\/\u629c\u5200\u524d\u304b\u3064\u629c\u5200\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u518d\u751f\u4e2d\u3067\u306f\u306a\u3044\u3068\u304d\n            if (isDeactivatedWeapon && !inTranWeapon)\n            {\n                \/\/\u629c\u5200\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u59cb\n                simpleAnimation.CrossFade(&quot;SetWeapon&quot;, 0.1f);\n\n                \/\/\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u4e2d\u30d5\u30e9\u30b0\u3092ON\u306b\n                inTranWeapon = true; \n\n                \/\/\u30b3\u30eb\u30fc\u30c1\u30f3\u30b9\u30bf\u30fc\u30c8\n                StartCoroutine(&quot;inTranWeaponReset&quot;);\n\n            }\n            \/\/\u629c\u5200\u5b8c\u4e86\u304b\u3064\u629c\u5200\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u518d\u751f\u4e2d\u3067\u306f\u306a\u3044\u3068\u304d\n            else if (isActivatedWeapon && !inTranWeapon)\n            {\n                \/\/\u9798\u306b\u7d0d\u3081\u308b\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u958b\u59cb\n                simpleAnimation.CrossFade(&quot;SetWeapon&quot;, 0.1f);\n\n                \/\/\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u4e2d\u30d5\u30e9\u30b0\u3092ON\u306b\n                inTranWeapon = true;\n\n                \/\/\u30b3\u30eb\u30fc\u30c1\u30f3\u30b9\u30bf\u30fc\u30c8\n                StartCoroutine(&quot;inTranWeaponReset&quot;);\n            }\n        }\n\n        \/\/\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u518d\u751f\u4e2d\u3067\u306f\u306a\u3044\u6642\n        if (!inTranWeapon)\n        {\n            \/\/Idle\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u518d\u751f\n            simpleAnimation.CrossFade(&quot;WeaponIdle&quot;, 0.1f);\n        }\n    }\n    private IEnumerator inTranWeaponReset()\n    {\n        \/\/0.3\u79d2\u5f85\u6a5f\uff08\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u3061\u3087\u3046\u3069\u3044\u3044\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u5200\u306e\u89aa\u5b50\u95a2\u4fc2\u3092\u4ed8\u3051\u66ff\u3048\u308b\u305f\u3081\uff09\n        yield return new WaitForSeconds(0.3f);\n\n        \/\/\u629c\u5200\u524d\u306e\u3068\u304d\n        if (isDeactivatedWeapon)\n        {\n            \/\/\u5200\u3092\u6301\u3061\u624b\u306e\u5b50\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u5909\u66f4\n            weapon.gameObject.transform.parent = weaponOn.gameObject.transform;\n\n            \/\/\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u629c\u5200\u72b6\u614b\u306e\u30dd\u30b8\u30b7\u30e7\u30f3\u3078\u79fb\u52d5\n            weapon.gameObject.transform.localPosition = weaponOnPos;\n            weapon.gameObject.transform.localEulerAngles = weaponOnRot;\n            isActivatedWeapon = true; \/\/\u629c\u5200\u4e2d\u30d5\u30e9\u30b0\u3092true\u306b\n            isDeactivatedWeapon = false; \/\/\u629c\u5200\u524d\u30d5\u30e9\u30b0\u3092false\u306b\n        }\n        \/\/\u629c\u5200\u5f8c\u306e\u3068\u304d\n        else if (isActivatedWeapon)\n        {\n            \/\/\u5200\u3092\u9798\u306e\u5b50\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u5909\u66f4\n            weapon.gameObject.transform.parent = swordPod.gameObject.transform;\n\n            \/\/\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u629c\u5200\u524d\u72b6\u614b\u306e\u30dd\u30b8\u30b7\u30e7\u30f3\u3078\u79fb\u52d5\n            weapon.gameObject.transform.localPosition = Vector3.zero;\n            weapon.gameObject.transform.localEulerAngles = Vector3.zero;\n            isActivatedWeapon = false; \/\/\u629c\u5200\u4e2d\u30d5\u30e9\u30b0\u3092true\u306b\n            isDeactivatedWeapon = true; \/\/\u629c\u5200\u524d\u30d5\u30e9\u30b0\u3092true\u306b\n        }\n        \/\/\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u518d\u751f\u30d5\u30e9\u30b0\u3092false\u306b\n        inTranWeapon = false;\n    }\n}\n<\/code><\/pre><\/div>\n\n\n\n<p>\u7279\u8a18\u4e8b\u9805\u3068\u3057\u3066\u306f\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Inspector\u3067Rigidbody\u3092\u53d6\u308a\u4ed8\u3051\u3066\u304a\u304f\u3002<\/li><li>Inspector\u306eSimpleAnimation\u306b\u5fc5\u8981\u306a\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u53d6\u308a\u4ed8\u3051\u3066\u304a\u304f<\/li><li>Inspector\u3067Weapon\u3001SwordPod\u306b\u305d\u308c\u305e\u308c\u5200\u3068\u9798\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5bfe\u5fdc\u4ed8\u3051\u3066\u304a\u304f\u3002<\/li><li>\u9798\u306e\u4f4d\u7f6e\u3068\u5200\u306e\u6301\u3061\u624b\u306e\u4f4d\u7f6e\u59ff\u52e2\u306f\u3042\u3089\u304b\u3058\u3081scene\u3092\u898b\u306a\u304c\u3089\u8abf\u6574\u3057\u3066\u304a\u304f\u3002<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>\u629c\u5200\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u304c\u5b8c\u4e86\u3059\u308b\u307e\u3067idle\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306b\u30d5\u30e9\u30b0\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b(inTranWeapon)<\/li><li>\u30b3\u30eb\u30fc\u30c1\u30f3\u3092\u4f7f\u7528\u3057\u3066\u5200\u306e\u89aa\u5b50\u95a2\u4fc2\u3092\u9798\u304b\u3089\u6301\u3061\u624b\u306b\u5909\u3048\u308b\u30bf\u30a4\u30df\u30f3\u30b0\u3092\u8abf\u6574\u3059\u308b\u3002<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u4ee5\u4e0a<\/p>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">Unity\u3092\u4e00\u304b\u3089\u5b66\u3076\u306e\u306b\u304a\u3059\u3059\u3081\u306e\u672c\u306f\u30b3\u30c1\u30e9<\/span><\/strong><\/p>\n\n\n\n<iframe style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"https:\/\/rcm-fe.amazon-adsystem.com\/e\/cm?ref=qf_sp_asin_til&amp;t=sebone0f-22&amp;m=amazon&amp;o=9&amp;p=8&amp;l=as1&amp;IS2=1&amp;detail=1&amp;asins=B08CB1RS5V&amp;linkId=18bb2ebedf43ec8b22e41eae43c36cd0&amp;bc1=000000&amp;lt1=_blank&amp;fc1=333333&amp;lc1=0066c0&amp;bg1=ffffff&amp;f=ifr\">\n    <\/iframe>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 Unity\u3067\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u306b\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u3051\u3066\u5263\u3092\u629c\u5200\u3059\u308b\u65b9&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":1805,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"ja","_original_post":"https:\/\/obenkyolab.com\/?p=2569","footnotes":""},"categories":[44],"tags":[],"class_list":["post-2569","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-unity","ja"],"_links":{"self":[{"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/posts\/2569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2569"}],"version-history":[{"count":15,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/posts\/2569\/revisions"}],"predecessor-version":[{"id":4754,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/posts\/2569\/revisions\/4754"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/media\/1805"}],"wp:attachment":[{"href":"https:\/\/obenkyolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}