{"id":823,"date":"2015-08-03T23:03:16","date_gmt":"2015-08-03T14:03:16","guid":{"rendered":"http:\/\/androiphone.uvs.jp\/?p=823"},"modified":"2017-03-23T11:41:13","modified_gmt":"2017-03-23T02:41:13","slug":"andengine-box2d-%e7%b0%a1%e5%8d%98%e3%81%aabody%e3%80%81%e8%a4%87%e9%9b%91%e3%81%aa%e5%bd%a2%e6%85%8b%e3%81%aebody%e3%82%92%e3%81%a4%e3%81%8f%e3%82%8b%e3%80%80%e3%81%9d%e3%81%ae1","status":"publish","type":"post","link":"https:\/\/androiphone.uvs.jp\/?p=823","title":{"rendered":"[AndEngine Box2d] \u7c21\u5358\u306aBody\u3001\u8907\u96d1\u306a\u5f62\u614b\u306eBody\u3092\u3064\u304f\u308b\u3000\u305d\u306e1"},"content":{"rendered":"<p>\u3053\u308c\u3092\u89e3\u6c7a\u3059\u308b\u306e\u306b\u76f8\u5f53\u306e\u6642\u9593\u304c\u304b\u304b\u3063\u305f\u306e\u3067\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b\u30e1\u30e2\u3002<\/p>\n<p>\u307e\u305a\u3001Sprite\u3092\u8aad\u307f\u8fbc\u3093\u3060\u5f8c\u306e\u624b\u7d9a\u304d\u3068\u3057\u3066 \u305d\u306eSprite\u306e\u525b\u4f53\u306e\u5b9a\u7fa9\u3092Body\u306b\u884c\u3044\u3001\u95a2\u9023\u4ed8\u3051\u308b\u3068\u3044\u3046\u4f5c\u696d\u304c\u5fc5\u8981\u3067\u3042\u308b \u305d\u306e\u70ba\u306b\u306f\u8272\u3005\u624b\u9806\u3092\u8e0f\u307e\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>(1)Sprite\u306e\u9802\u70b9\u30c7\u30fc\u30bf\u306e\u914d\u5217Vector2[]\u3092\u4f5c\u308b<\/strong><\/span><\/p>\n<p>\u5186\u3001\u77e9\u5f62\u306fPhysicsFactory.createBoxBody\u3001PhysicsFactory.createCircleBody\u3067\u4f5c\u3063\u305f\u65b9\u304c\u624b\u3063\u53d6\u308a\u65e9\u3044\u3002 \u9802\u70b9\u6570\u304c8\u70b9\u4ee5\u4e0b\u306e\u5834\u5408\u3001PhysicsFactory.createPolygonBody\u3092\u4f7f\u3063\u3066\u4f5c\u308c\u308b\u306e\u3067\u3001\u5927\u62b5\u306f\u3053\u308c\u3067\u307e\u304b\u306a\u3048\u308b\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3046\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u300cAndengine Vertex Helper\u300d(Body\u306e\u5b9a\u7fa9\u3092\u7c21\u5358\u306b\u884c\u3048\u308b\u30c4\u30fc\u30eb)\u3092\u542b\u3080\u3001Body\u306e\u4f5c\u308a\u65b9\u306f\u4e0b\u8a18\u306e\u30b5\u30a4\u30c8\u306b\u3066\u8a73\u7d30\u306b\u89e3\u8aac\u3055\u308c\u3066\u3044\u308b\u3002\u611f\u8b1d<\/p>\n<p><a href=\"http:\/\/goods-tmu.blogspot.jp\/2014\/03\/andengine-vertex-helper.html\">http:\/\/goods-tmu.blogspot.jp\/2014\/03\/andengine-vertex-helper.html<\/a><\/p>\n<p>\u3057\u304b\u3057\u30018\u70b9\u4ee5\u4e0a\u3042\u308b\u5834\u5408\u3001\u5177\u4f53\u7684\u306b\u3069\u3046\u3084\u3063\u3066\u4f5c\u308b\u306e\u304b\u3092\u89e3\u8aac\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u304c\u306a\u304f\u3001\u82e6\u6226\u3057\u305f\u3002\u307e\u305a\u3001\u9802\u70b9\u30c7\u30fc\u30bf\u3092\u4f5c\u308b\u6642\u306e\u6ce8\u610f\u4e8b\u9805\u306fBox2d\u306b\u5171\u901a\u306a\u306e\u3067\u662f\u975e\u78ba\u8a8d\u3057\u305f\u3044\u3002\u4e0b\u8a18\u306e\u30b5\u30a4\u30c8\u3092\u3088\u304f\u53c2\u8003\u306b\u3057\u3066\u4f5c\u6210\u3059\u308b\u3068\u3088\u3044\u3060\u308d\u3046\u3002<\/p>\n<p><a href=\"http:\/\/tech.nitoyon.com\/ja\/blog\/2009\/05\/11\/box2d-polygon\/\">http:\/\/tech.nitoyon.com\/ja\/blog\/2009\/05\/11\/box2d-polygon\/<\/a><\/p>\n<p>\u30fb\u70b9\u3092\u5b9a\u7fa9\u3059\u308b\u9806\u756a\u306b\u6ce8\u610f \u30fb\u51f8\u5305\u306b\u305b\u3088<\/p>\n<p>\u30fb\u9802\u70b9\u6570\u306f\uff18\u500b\u307e\u3067(1\u30b7\u30a7\u30a4\u30d7\u3042\u305f\u308a)<\/p>\n<p>\u3053\u308c\u306f\u7d76\u5bfe\u5b88\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002\u3057\u304b\u3082\u3001\u30d3\u30eb\u30c8\u6642\u306b\u30a8\u30e9\u30fc\u306b\u306a\u308b\u306e\u306f\u30aa\u30fc\u30d0\u30fc8\u9802\u70b9\u3050\u3089\u3044\u3067\u3001\u51f9\u578b\u306e\u30dd\u30ea\u30b4\u30f3\u30c7\u30fc\u30bf\u3068\u304b\u306f\u6b63\u5e38\u306b\u30d3\u30eb\u30c8\u3092\u901a\u904e\u3057\u3001\u7269\u7406\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u304c\u304a\u304b\u3057\u304f\u306a\u308b\u306e\u307f\u3067\u3042\u308b\u3002\u7a81\u304d\u6b62\u3081\u3081\u308b\u306e\u306b\u6642\u9593\u304c\u304b\u304b\u308b\u30fb\u30fb\u30fb\u3002<\/p>\n<p>\u9802\u70b9\u6570\u304c8\u500b\u307e\u3067\u3068\u3042\u308b\u304c\u30019\u70b9\u4ee5\u4e0a\u306e\u5834\u5408\u306f\u4e09\u89d2\u5f62(\u56db\u89d2\u5f62\u3067\u3082\u4e94\u89d2\u5f62\u3067\u30828\u70b9\u307e\u3067\u306a\u3089ok\u3002\u4e09\u89d2\u5f62\u304c\u30b9\u30bf\u30f3\u30c0\u30fc\u30c9\u3068\u306e\u3053\u3068)\u306e\u30b7\u30a7\u30a4\u30d7\u3092\u7d44\u307f\u5408\u308f\u305b\u3066Body\u3092\u4f5c\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n<p><a href=\"http:\/\/androiphone.uvs.jp\/wp-content\/uploads\/2015\/08\/8089e50294910c6cb163e5cb54ad137b.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-824\" src=\"http:\/\/androiphone.uvs.jp\/wp-content\/uploads\/2015\/08\/8089e50294910c6cb163e5cb54ad137b-300x173.png\" alt=\"\u540d\u79f0\u672a\u8a2d\u5b9a-2\" width=\"300\" height=\"173\" srcset=\"https:\/\/androiphone.uvs.jp\/wp-content\/uploads\/2015\/08\/8089e50294910c6cb163e5cb54ad137b-300x173.png 300w, https:\/\/androiphone.uvs.jp\/wp-content\/uploads\/2015\/08\/8089e50294910c6cb163e5cb54ad137b.png 826w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u5b9f\u969b\u306b\u3001\u661f\u578b\u306e\u30b9\u30d7\u30e9\u30a4\u30c8\u306eBody\u3092\u4f5c\u308b\u969b\u3001\u9802\u70b9\u6570\u304c10\u500b\u306e\u4e0a\u306b\u3001\u51f9\u578b\u306b\u306a\u308b\u305f\u3081\u3001\u4e2d\u5fc3\u304b\u308910\u500b\u306e\u4e09\u89d2\u5f62\u3067\u5206\u3051\u3066\u307f\u305f\u3002\u3082\u3046\u5c11\u3057\u30b9\u30de\u30fc\u30c8\u306b\u5206\u3051\u3089\u308c\u308b\u6c17\u304c\u3059\u308b\u304c\u3001\u3068\u308a\u3042\u3048\u305a\u3053\u308c\u3067\u884c\u304d\u305f\u3044\u3068\u601d\u3046\u3002\u53f3\u306b\u30b3\u30fc\u30c9\u304c\u3067\u3066\u3044\u308b\u306e\u3067\u30011-10\u306e\u4e09\u89d2\u5f62\u306e\u30c7\u30fc\u30bf\u3092\u30bd\u30fc\u30b9\u306b\u5b9a\u7fa9\u3059\u308c\u3070\u3088\u3044\u3002\u53c2\u8003\u307e\u30671\u3064\u76ee\u306e\u4e09\u89d2\u5f62\u306e\u30c7\u30fc\u30bf\u306e\u5b9a\u7fa9\u3092\u4e0b\u306b\u63b2\u8f09\u3002<\/p>\n<p>[java]<br \/>\n        final Vector2[] vertices1 = {<br \/>\n        \t\tnew Vector2(-0.46000f*width, -0.11579f*height),<br \/>\n        \t\tnew Vector2(-0.19000f*width, -0.23684f*height),<br \/>\n        \t\tnew Vector2(+0.00000f*width, -0.00000f*height),<\/p>\n<p>        };<\/p>\n<p>[\/java]<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>(2)1\u3064\u306eVector2[]\u914d\u5217\u304b\u3089Body.\u3092\u4f5c\u308aSprite\u3068\u95a2\u9023\u4ed8\u3051\u308b(\u7c21\u5358\u306aBody)<\/strong><\/span><\/p>\n<p>8\u70b9\u4ee5\u4e0b\u306e\u5834\u5408\u306f\u3001\u4e09\u89d2\u5f62\u306b\u5206\u3051\u308b\u3053\u3068\u306a\u304f\u3001\u3053\u306eVector2[]\u914d\u5217\u3092PhysicsFactory.createPolygonBody\u306b\u6295\u3052\u308b\u3068\u3088\u3044(\u4e0b\u30b3\u30fc\u30c9)\u3002FIXTURE_DEF\u306f\u3001\u5bc6\u5ea6\u3001\u5f3e\u6027\u529b\u3001\u6469\u64e6\u3001\u30bb\u30f3\u30b5\u30fc\u3001\u30ab\u30c6\u30b4\u30ea\u30d3\u30c3\u30c8\u3001\u30ab\u30c6\u30b4\u30ea\u30de\u30b9\u30af\u30d3\u30c3\u30c8\u3001\u30b0\u30eb\u30fc\u30d7\u756a\u53f7\u3068\u3044\u3046\u3053\u3068\u3089\u3057\u3044\u3002\u3064\u307e\u308a\u3001SpriteKit\u306eSKPhysicsBody\u95a2\u9023\u306e\u8a2d\u5b9a\u3092\u884c\u3046\u3002\u8a73\u3057\u304f\u306f<\/p>\n<p><a href=\"http:\/\/goods-tmu.blogspot.jp\/2013\/07\/andengineextension.html\">http:\/\/goods-tmu.blogspot.jp\/2013\/07\/andengineextension.html<\/a><\/p>\n<p>SpriteKit\u306b\u76f8\u5f53\u3059\u308b\u90e8\u5206\u3067\u306f<\/p>\n<p><a href=\"http:\/\/spritekit.senchan-office.com\/index.php\/skphysicsbody\">http:\/\/spritekit.senchan-office.com\/index.php\/skphysicsbody<\/a><\/p>\n<p>\u3067\u53c2\u8003\u306b\u306a\u308b\u3002<\/p>\n<p>[java]<br \/>\n\tprivate PhysicsWorld mPhysicsWorld;<br \/>\n\u3000\u3000\u3000\u3000 private static final FixtureDef FIXTURE_DEF = PhysicsFactory.createFixtureDef(1, 0.5f, 0.5f);<\/p>\n<p>\t\/\/ 8\u70b9\u4ee5\u4e0b\u306e\u9802\u70b9\u6570\u306eBody\u3092\u4f5c\u308b<br \/>\n\tprivate void addsp2(float x,float y){<br \/>\n\t\tSprite sp = getBaseActivity().getResourceUtil().getSprite(&quot;waku_star.png&quot;);<br \/>\n\t\tsp.setPosition(x,y);<\/p>\n<p>\t final float width = sp.getWidthScaled() \/ PIXEL_TO_METER_RATIO_DEFAULT;<br \/>\n\t final float height = sp.getHeightScaled() \/ PIXEL_TO_METER_RATIO_DEFAULT;<\/p>\n<p>        final Vector2[] vertices2 = {<br \/>\n        \t\tnew Vector2(-0.46000f*width, -0.09474f*height),<br \/>\n        \t\tnew Vector2(+0.00500f*width, -0.45789f*height),<br \/>\n        \t\tnew Vector2(+0.45500f*width, -0.08947f*height),<br \/>\n        \t\tnew Vector2(+0.28000f*width, +0.42632f*height),<br \/>\n        \t\tnew Vector2(-0.27500f*width, +0.42632f*height),<br \/>\n        };<\/p>\n<p>        final Body body  = PhysicsFactory.createPolygonBody(this.mPhysicsWorld, sp,vertices2 ,BodyType.DynamicBody, FIXTURE_DEF);<br \/>\n\t\tattachChild(sp);<br \/>\n\t\tthis.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(sp, body, true, true));<\/p>\n<p>\t}<br \/>\n[\/java]<\/p>\n<p>\u3057\u304b\u3057\u3001\u3053\u308c\u3067\u306fVector2[]\u914d\u5217\u304c\u4e00\u3064\u3057\u304b\u6e21\u305b\u306a\u3044\u305f\u3081\u3001\u8907\u6570\u306eVector2[]\u914d\u5217\u3092\u7528\u3044\u305fBody\u304c\u3064\u304f\u308c\u306a\u3044\u3002\u305d\u308c\u3092\u3001<a href=\"http:\/\/androiphone.uvs.jp\/?p=834\">\u305d\u306e2<\/a>\u3067\u8aac\u660e\u3059\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u308c\u3092\u89e3\u6c7a\u3059\u308b\u306e\u306b\u76f8\u5f53\u306e\u6642\u9593\u304c\u304b\u304b\u3063\u305f\u306e\u3067\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b\u30e1\u30e2\u3002 \u307e\u305a\u3001Sprite\u3092\u8aad\u307f\u8fbc\u3093\u3060\u5f8c\u306e\u624b\u7d9a\u304d\u3068\u3057\u3066 \u305d\u306eSprite\u306e\u525b\u4f53\u306e\u5b9a\u7fa9\u3092Body\u306b\u884c\u3044\u3001\u95a2\u9023\u4ed8\u3051\u308b\u3068\u3044\u3046\u4f5c\u696d\u304c\u5fc5\u8981\u3067\u3042\u308b \u305d\u306e\u70ba\u306b\u306f\u8272\u3005\u624b\u9806\u3092\u8e0f\u307e\u306a\u3051 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"","_original_post":"","footnotes":""},"categories":[13,5,20,6],"tags":[],"class_list":["post-823","post","type-post","status-publish","format-standard","hentry","category-andengine","category-android","category-box2d","category-6","ja"],"_links":{"self":[{"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/posts\/823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=823"}],"version-history":[{"count":16,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/posts\/823\/revisions"}],"predecessor-version":[{"id":1427,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/posts\/823\/revisions\/1427"}],"wp:attachment":[{"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}