{"id":1784,"date":"2022-07-03T16:07:44","date_gmt":"2022-07-03T07:07:44","guid":{"rendered":"https:\/\/dalomo.net\/blog\/?p=1784"},"modified":"2022-09-19T10:53:44","modified_gmt":"2022-09-19T01:53:44","slug":"%e3%80%8e%e6%9d%b1%e4%ba%ac%e3%83%91%e3%82%bd%e3%82%b3%e3%83%b3%e3%82%af%e3%83%a9%e3%83%96%e3%80%8f%e3%81%a7%e3%82%a2%e3%82%a4%e3%83%89%e3%83%ab%e3%81%a8unity%e3%82%92%e5%ad%a6%e3%81%b6-%e2%91%a3","status":"publish","type":"post","link":"https:\/\/dalomo.net\/blog\/2022\/07\/03\/1784\/","title":{"rendered":"\u300e\u6771\u4eac\u30d1\u30bd\u30b3\u30f3\u30af\u30e9\u30d6\u300f\u3067\u30a2\u30a4\u30c9\u30eb\u3068Unity\u3092\u5b66\u3076 \u2463 \u7389\u8ee2\u304c\u3057\u30b2\u30fc\u30e0"},"content":{"rendered":"<h1>\u7389\u8ee2\u304c\u3057\u30b2\u30fc\u30e0<\/h1>\n<p>\u5f15\u304d\u7d9a\u304d\u3084\u3063\u3066\u3044\u3053\uff5e\u3002<\/p>\n<h2>\u5927\u304d\u3055\u5909\u3048\u305f\u308a\u3001\u4ed6\u306e\u969c\u5bb3\u7269\u4f5c\u3063\u305f\u308a<\/h2>\n<p>\u3044\u3064\u306e\u9593\u306b\u304b\u4f5c\u3089\u308c\u3066\u3044\u305f\u306e\u3067\u4f5c\u3063\u3068\u304f\u3002\u5927\u304d\u3055\u306fInspector\u306eScale\u3067\u5909\u3048\u3089\u308c\u308b\u3002\u3042\u3068\u306a\u3093\u304b\u3044\u3064\u306e\u9593\u306b\u304b\u30b4\u30fc\u30eb\u304c\u5de6\u306e\u7c60\u306b\u306a\u3063\u3066\u308b\u306a\u3002Circle\u3068Square\u306e\u30b9\u30d7\u30e9\u30a4\u30c8\u3092\u4f5c\u3063\u3066\u3001\u305d\u308c\u305e\u308c\u306bCollider\u3092\u4ed8\u4e0e\u3059\u308c\u3070\u3044\u3044\u306e\u304b\u306a\u3002<\/p>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk05.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1785\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk05-300x163.png\" alt=\"\" width=\"300\" height=\"163\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk05-300x163.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2022\/07\/tk05.png 750w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h2>\u8ee2\u304c\u3059\u7389\u3092\u4f5c\u308b<\/h2>\n<p>\u30ad\u30fc\u3067\u5de6\u53f3\u306b\u52d5\u304d\u3001\u843d\u3061\u3066\u3044\u304f\u3088\u3046\u306a\u52d5\u304d\u3092\u3059\u308b\u7389\u3092\u4f5c\u308b\u3002<\/p>\n<h3>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u308b<\/h3>\n<p>Circle\u306e\u30b9\u30d7\u30e9\u30a4\u30c8\u3092\u914d\u7f6e\u3057\u3001Rigidbody2D\u3068CircleColider2D\u3092\u4ed8\u4e0e\u3059\u308b\u3002\u3053\u306e\u6642\u70b9\u3067\u518d\u751f\u3059\u308b\u3068\u3001\u6b6f\u8eca\u3068\u3076\u3064\u304b\u3063\u305f\u5834\u5408\u306b\u305d\u308c\u3082\u308d\u3068\u3082\u4e0b\u306b\u843d\u3061\u3066\u3044\u304f\u3002<\/p>\n<h3>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u56fa\u5b9a\u3059\u308b<\/h3>\n<p>\u7389\u306f\u52d5\u3044\u3066\u3066\u307b\u3057\u3044\u304c\u3001\u6b6f\u8eca\u306f\u52d5\u3044\u3066\u307b\u3057\u304f\u306a\u3044\u3002\u6b6f\u8eca\u306b\u52d5\u304b\u306a\u3044\u3088\u3046\u306a\u8a2d\u5b9a\u3092\u4ed8\u4e0e\u3059\u308b\u3002\u6b6f\u8eca\u306eRigidbody\u306bConstraints\u3068\u3044\u3046\u9805\u76ee\u304c\u3042\u308b\u306e\u3067\u3001XY\u306b\u30c1\u30a7\u30c3\u30af\u5165\u308c\u308b\u3002\u305d\u306e\u307b\u304b\u306e\u969c\u5bb3\u7269\u304c\u306a\u305c\u5f53\u305f\u3063\u3066\u3082\u52d5\u304b\u306a\u3044\u304b\u3068\u3044\u3046\u3068Rigidbody2D\u304c\u4ed8\u4e0e\u3055\u308c\u3066\u306a\u3044\u304b\u3089\u3002\u305d\u306e\u305f\u3081\u7269\u7406\u6f14\u7b97\u306e\u5f71\u97ff\u306f\u53d7\u3051\u305a\u3001\u5f53\u305f\u308a\u5224\u5b9a\u3060\u3051\u304c\u52b9\u304f\u3002\u3075\u30fc\u3093\u3002<\/p>\n<h3>\u30ad\u30fc\u5165\u529b\u3067\u7389\u3092\u52d5\u304b\u3059<\/h3>\n<p>\u89e3\u8aac\u3092\u305d\u306e\u307e\u307e\u3084\u308b\u3002\u7389\u306eGravityScale\u3092\uff10\u306b\u3059\u308b\u3002NewScript\u3067\u30b3\u30fc\u30c9\u66f8\u304f\u3002<\/p>\n<pre><code class=\"cs\">public class BallControl : MonoBehaviour\r\n{\r\n    Rigidbody2D m_rigidbody;\r\n    bool m_fallFlag = false;\r\n\r\n    \/\/ Start is called before the first frame update\r\n    void Start()\r\n    {\r\n        m_rigidbody = GetComponent();\r\n    }\r\n\r\n    \/\/ Update is called once per frame\r\n    void FixedUpdate()\r\n    {\r\n\r\n        if (m_fallFlag)\r\n        {\r\n            m_rigidbody.velocity = new Vector2(0, 0);\r\n        }\r\n        else\r\n        {\r\n\r\n            if (Input.GetKey(KeyCode.LeftArrow)) \r\n            {\r\n                m_rigidbody.velocity = new Vector2(-7, 0);\r\n            }\r\n            else if (Input.GetKey(KeyCode.RightArrow)) \r\n            {\r\n                m_rigidbody.velocity = new Vector2(7, 0);\r\n            }\r\n            else\r\n            {\r\n                m_rigidbody.velocity = new Vector2(0, 0);\r\n            }\r\n\r\n            if (Input.GetKey(KeyCode.Space))\r\n            {\r\n                m_rigidbody.gravityScale = 10;\r\n                m_fallFlag = true;\r\n            }\r\n        }\r\n    }\r\n}<\/code><\/pre>\n<p>\u3046\u3080\u3002\u3053\u306e\uff5b\uff5d\u306e\u4f7f\u3044\u65b9\u304c\u5acc\u3044\u306a\u3093\u3060\u3051\u3069\u3069\u3046\u306b\u304b\u306a\u3089\u3093\u304b\u306a\u3002<\/p>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/QNrOfXovfqw\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>\u3067\u304d\u305f\u3002\u3044\u3047\u3044\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7389\u8ee2\u304c\u3057\u30b2\u30fc\u30e0 \u5f15\u304d\u7d9a\u304d\u3084\u3063\u3066\u3044\u3053\uff5e\u3002 \u5927\u304d\u3055\u5909\u3048\u305f\u308a\u3001\u4ed6\u306e\u969c\u5bb3\u7269\u4f5c\u3063\u305f\u308a \u3044\u3064\u306e\u9593\u306b\u304b\u4f5c\u3089\u308c\u3066\u3044\u305f\u306e\u3067\u4f5c\u3063\u3068\u304f\u3002\u5927\u304d\u3055\u306fInspector\u306eScale\u3067\u5909\u3048\u3089\u308c\u308b\u3002\u3042\u3068\u306a\u3093\u304b\u3044\u3064\u306e\u9593\u306b\u304b\u30b4\u30fc\u30eb\u304c\u5de6\u306e\u7c60\u306b\u306a\u3063\u3066\u308b\u306a\u3002Ci &hellip; <a href=\"https:\/\/dalomo.net\/blog\/2022\/07\/03\/1784\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1749,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[9],"tags":[166,165],"class_list":["post-1784","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-9","tag-unity","tag-165"],"_links":{"self":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/1784","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/comments?post=1784"}],"version-history":[{"count":4,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/1784\/revisions"}],"predecessor-version":[{"id":1826,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/1784\/revisions\/1826"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media\/1749"}],"wp:attachment":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media?parent=1784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/categories?post=1784"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/tags?post=1784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}