{"id":3084,"date":"2013-09-20T22:08:25","date_gmt":"2013-09-20T13:08:25","guid":{"rendered":"http:\/\/peta.okechan.net\/blog\/?p=3084"},"modified":"2013-12-18T09:57:54","modified_gmt":"2013-12-18T00:57:54","slug":"spritekit%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-%e3%81%9d%e3%81%ae2","status":"publish","type":"post","link":"https:\/\/peta.okechan.net\/blog\/archives\/3084","title":{"rendered":"SpriteKit\u3092\u4f7f\u3063\u3066\u307f\u308b \u305d\u306e2"},"content":{"rendered":"<p><a href=\"https:\/\/peta.okechan.net\/blog\/archives\/3068\" title=\"SpriteKit\u3092\u4f7f\u3063\u3066\u307f\u308b \u305d\u306e1\">\u524d\u56de<\/a>\u3001SpriteKit Game\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u751f\u6210\u3055\u308c\u305f\u30bd\u30fc\u30b9\u3092\u898b\u305f\u3002<br \/>\n\u305d\u306e\u30bd\u30fc\u30b9\u3092\u30d9\u30fc\u30b9\u306b\u3057\u3066\u3001\u4eca\u56de\u306fSpriteKit\u306e\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u3092\u5229\u7528\u3059\u308b\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u3066\u307f\u308b\u3002<\/p>\n<h3>\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u306e\u5229\u7528\u306b\u5fc5\u8981\u306a\u524d\u63d0\u77e5\u8b58<\/h3>\n<p>\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u306b\u3082\u8272\u3005\u3042\u3063\u3066\u3001\u62bd\u8c61\u5316\u306e\u65b9\u6cd5\u3082\u69d8\u3005\u3060\u3063\u305f\u308a\u69cb\u6210\u8981\u7d20\u306e\u540d\u79f0\u304c\u8272\u3005\u9055\u3063\u3066\u305f\u308a\u3068\u304b\u3042\u308b\u3068\u601d\u3046\u3051\u3069\u3001\u4e00\u822c\u7684\u306b\u306f\u4eee\u60f3\u7684\u306a\u7269\u7406\u4e16\u754c\u3092\u8868\u3059\u300c\u306a\u3093\u3068\u304b\u30ef\u30fc\u30eb\u30c9\u300d\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u3001\u525b\u4f53\u3092\u8868\u3059\u300c\u306a\u3093\u3068\u304b\u30dc\u30c7\u30a3\u300d\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u767b\u9332\u3057\u3001\u3042\u3068\u306f\u30ef\u30fc\u30eb\u30c9\u306e\u6642\u9593\u3092\u3061\u3087\u3063\u3068\u3065\u3064\u9032\u3081\u308b\u4e8b\u3067\u30b7\u30df\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u3046\u3068\u3044\u3046\u306e\u304c\u57fa\u672c\u306b\u306a\u308b\u3068\u601d\u3046\u3002<\/p>\n<p>SpriteKit\u306b\u3082\u300c\u306a\u3093\u3068\u304b\u30ef\u30fc\u30eb\u30c9\u300d\u3084\u300c\u306a\u3093\u3068\u304b\u30dc\u30c7\u30a3\u300d\u306b\u76f8\u5f53\u3059\u308b\u30af\u30e9\u30b9\u304c\u3042\u308a\u3001\u305d\u308c\u305e\u308cSKPhysicsWorld\u3068SKPhysicsBody\u3068\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u305f\u3060\u3057SpriteKit\u306e\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u306f\u3001\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u3068\u3057\u3066\u72ec\u7acb\u3057\u305f\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u306f\u306a\u304f\u3001SpriteKit\u306b\u7d71\u5408\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u4e00\u822c\u7684\u306a\u3082\u306e\u3068\u4f7f\u3044\u52dd\u624b\u304c\u9055\u3046\uff08\u30b3\u30fc\u30c9\u306e\u8a18\u8ff0\u91cf\u304c\u5c11\u306a\u304f\u3066\u6e08\u3080\uff09\u90e8\u5206\u304c\u3042\u308b\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001SKPhysicsWorld\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306f\u751f\u6210\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u3002<br \/>\n\u3068\u3044\u3046\u306e\u3082\u3001SKScene\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3059\u308b\u3068\u81ea\u52d5\u7684\u306b\u305d\u306ephysicsWorld\u30d7\u30ed\u30d1\u30c6\u30a3\u306bSKPhysicsWorld\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u30bb\u30c3\u30c8\u3055\u308c\u308b\u304b\u3089\u3067\u3042\u308b\u3002<\/p>\n<p>\u307e\u305f\u3001\u7269\u7406\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u5b9f\u884c\u3092\u6307\u793a\u3059\u308b\u30b3\u30fc\u30c9\u3082\u308f\u3056\u308f\u3056\u66f8\u304f\u5fc5\u8981\u304c\u306a\u3044\u3002\uff08\u305d\u306e\u8fba\u308a\u306f\u81ea\u52d5\u7684\u306b\u5185\u90e8\u3067\u3046\u307e\u3044\u5177\u5408\u3084\u3063\u3066\u304f\u308c\u308b\u307f\u305f\u3044\u3002\uff09<br \/>\n\u3068\u3044\u3046\u304b\u3001\u7269\u7406\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u30921\u30b9\u30c6\u30c3\u30d7\u305a\u3064\u5b9f\u884c\u3059\u308b\u3088\u3046\u306aSKPhysicsWorld\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u516c\u958b\u3055\u308c\u3066\u3044\u306a\u3044\u3002\uff08\u591a\u5206\uff09<\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3001\u4f7f\u3046\u306e\u304c\u7c21\u5358\u306a\u4ee3\u308f\u308a\u306b\u81ea\u7531\u5ea6\u306f\u4f4e\u3081\u3067\u3042\u308b\u304c\u3001\u307e\u3041\u7c21\u5358\u306a2D\u30b2\u30fc\u30e0\u306e\u4f5c\u6210\u306b\u304a\u3044\u3066\u306f\u3053\u306e\u81ea\u7531\u5ea6\u306e\u4f4e\u3055\u304c\u554f\u984c\u306b\u306a\u308b\u4e8b\u306f\u5c11\u306a\u3044\u3093\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3046\u3002<\/p>\n<p>\u3061\u306a\u307f\u306bSpriteKit\u306e\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u306fSI\u5358\u4f4d\u3092\u63a1\u7528\u3057\u3066\u3044\u308b\u3002<\/p>\n<h3>\u76ee\u6a19<\/h3>\n<p><a href=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-13.54.59.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-13.54.59-180x300.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2013-09-20 13.54.59\" width=\"180\" height=\"300\" class=\"alignnone size-medium wp-image-3085\" srcset=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-13.54.59-180x300.png 180w, https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-13.54.59.png 594w\" sizes=\"auto, (max-width: 180px) 100vw, 180px\" \/><\/a><br \/>\n\u9759\u6b62\u753b\u3060\u3068\u306a\u3093\u306e\u3053\u3063\u3061\u3083\u5206\u304b\u3089\u3093\u3051\u3069\u3001\u307e\u3041\u8981\u306f\u30bf\u30c3\u30d7\u3057\u305f\u4f4d\u7f6e\u306b\u30dc\u30fc\u30eb\u3092\u914d\u7f6e\u3057\u3001\u305d\u308c\u304c\u753b\u9762\u306e\u4e0b\u5074\u306b\u5411\u304b\u3063\u3066\u843d\u4e0b\u3059\u308b\u30a2\u30d7\u30ea\u3092\u4f5c\u308b\u3002<\/p>\n<p>\u30dc\u30fc\u30eb\u306e\u753b\u50cf\u306f\u4ee5\u4e0b\u306e\u3082\u306e\u3092\u4f7f\u3063\u3066\u3044\u308b\u3002\uff08Blender\u3067\u30dd\u30ea\u30b4\u30f3\u6570\u5c11\u306a\u3081\u3067\u4f5c\u3063\u305f\u753b\u50cf\u306a\u306e\u3067\u30ab\u30af\u30ab\u30af\u3057\u3066\u308b\u3051\u3069\u3001\u3054\u81ea\u7531\u306b\u3054\u5229\u7528\u304f\u3060\u3055\u3044\u3002\uff09<br \/>\n<a href=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/Ball.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/Ball-150x150.png\" alt=\"Ball\" width=\"150\" height=\"150\" class=\"alignnone size-thumbnail wp-image-3089\" srcset=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/Ball-150x150.png 150w, https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/Ball.png 256w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><\/p>\n<h3>\u525b\u4f53\u306e\u30b3\u30fc\u30c9<\/h3>\n<p>\u4e0a\u8a18\u306e\u3068\u304a\u308a\u3001SKPhysicsWorld\u3092\u751f\u6210\u3057\u305f\u308a\u306f\u5fc5\u8981\u3058\u3083\u306a\u3044\u306e\u3067\u3001\u3044\u304d\u306a\u308a\u525b\u4f53\u306e\u8a2d\u5b9a\u306e\u30b3\u30fc\u30c9\u304b\u3089\u306f\u3058\u3081\u308b\u3002<br \/>\n<a href=\"https:\/\/peta.okechan.net\/blog\/archives\/3068\" title=\"SpriteKit\u3092\u4f7f\u3063\u3066\u307f\u308b \u305d\u306e1\">\u524d\u56de<\/a>\u306e-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event\u30e1\u30bd\u30c3\u30c9\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u308b\u3002<\/p>\n<pre class=\"brush: objc; title: ; notranslate\" title=\"\">-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {\r\n    \/* Called when a touch begins *\/\r\n    \r\n    for (UITouch *touch in touches) {\r\n        CGPoint location = &#x5B;touch locationInNode:self];\r\n        \r\n        SKSpriteNode *sprite = &#x5B;SKSpriteNode spriteNodeWithImageNamed:@&quot;Ball&quot;];\r\n        \r\n        sprite.position = location;\r\n        \r\n        const CGFloat radius = 20.0f;\r\n        SKPhysicsBody *pbody = &#x5B;SKPhysicsBody bodyWithCircleOfRadius:radius];\r\n        sprite.physicsBody = pbody;\r\n        sprite.size = (CGSize){radius * 2, radius * 2};\r\n        \r\n        &#x5B;self addChild:sprite];\r\n    }\r\n}<\/pre>\n<p>\u91cd\u8981\u306a\u306e\u306f[SKPhysicsBody bodyWithCircleOfRadius:radius]\u306e\u90e8\u5206\u3067\u3042\u308b\u3002<br \/>\n\u3053\u308c\u306b\u3088\u3063\u3066\u3001\u534a\u5f84radius\u306e\u5186\u306e\u5f62\u3092\u3057\u305f\u525b\u4f53\u304c\u751f\u6210\u3055\u308c\u308b\u3002<br \/>\n\u3053\u306e\u5834\u5408radius\u306f20\u306a\u306e\u3067\u3001\u753b\u9762\u4e0a\u3067\u306f\u534a\u5f8420\u30dd\u30a4\u30f3\u30c8\u76f8\u5f53\u306e\u5186\u3068\u306a\u308b\u3002<\/p>\n<p>\u305d\u3057\u305f\u3089\u3001sprite.physicsBody\u306b\u525b\u4f53\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3002<\/p>\n<p>\u6700\u5f8c\u306bsprite.size\u3092\u8a2d\u5b9a\u3057\u3066\u308b\u90e8\u5206\u306f\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u3068\u306f\u7121\u95a2\u4fc2\u3067\u3001\u8a2d\u5b9a\u3057\u305f\u525b\u4f53\u306e\u30b5\u30a4\u30ba\u3068\u898b\u305f\u76ee\u306e\u30b5\u30a4\u30ba\u3092\u63c3\u3048\u308b\u305f\u3081\u306e\u884c\u3067\u3042\u308b\u3002<br \/>\nradius\u306f\u534a\u5f84\u306a\u306e\u3067\u5186\u5168\u4f53\u306e\u30b5\u30a4\u30ba\u306b\u3059\u308b\u305f\u3081\u306b2\u500d\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>\u3053\u308c\u3060\u3051\u3067\u30dc\u30fc\u30eb\u304c\u753b\u9762\u4e0b\u306b\u5411\u304b\u3063\u3066\u843d\u3061\u308b\u30a2\u30d7\u30ea\u304c\u51fa\u6765\u305f\u3002<br \/>\n\u30dc\u30fc\u30eb\u304c\u753b\u9762\u4e0b\u306b\u843d\u4e0b\u3059\u308b\u306e\u306f\u3001SKPhysicsWorld\u306egravity\u30d7\u30ed\u30d1\u30c6\u30a3\uff082\u6b21\u5143\u30d9\u30af\u30c8\u30eb\uff09\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u5730\u7403\u306e\u91cd\u529b\u3092\u8868\u3059(0.0,-9.8)\u3068\u306a\u3063\u3066\u3044\u308b\u304b\u3089\u3067\u3042\u308b\u3002<br \/>\ngravity\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u5358\u4f4d\u306f\u30e1\u30fc\u30c8\u30eb\u6bce\u79d2\u6bce\u79d2\u3067\u3042\u308b\u3002<\/p>\n<p>\u3061\u306a\u307f\u306bSpriteKit\u306b\u304a\u3044\u3066\u306f\u30011\u30dd\u30a4\u30f3\u30c8\u306f2\/3\u30bb\u30f3\u30c1\u30e1\u30fc\u30c8\u30eb\u306b\u76f8\u5f53\u3059\u308b\u307f\u305f\u3044\uff08\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3067\u660e\u8a18\u3055\u308c\u3066\u3044\u308b\u90e8\u5206\u3092\u898b\u3064\u3051\u308b\u3053\u3068\u306f\u51fa\u6765\u306a\u304b\u3063\u305f\u304c\u8a08\u6e2c\u3057\u305f\u3089\u305d\u306e\u304f\u3089\u3044\u306b\u306a\u3063\u305f\uff09\u3002<\/p>\n<p>\u525b\u4f53\u306e\u8cea\u91cf\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u306a\u3044\u304c\u3001SKPhysicsBody\u306edensity\uff08\u5bc6\u5ea6\uff09\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c1\u30ad\u30ed\u30b0\u30e9\u30e0\u6bce\u5e73\u65b9\u30e1\u30fc\u30c8\u30eb\u3068\u306a\u3063\u3066\u304a\u308a\u3001\u525b\u4f53\u306e\u30b5\u30a4\u30ba\u304b\u3089\u8cea\u91cf\u306f\u81ea\u52d5\u7684\u306b\u8a08\u7b97\u3055\u308c\u308b\u3002<br \/>\n\u8cea\u91cf\u3092\u76f4\u63a5\u6307\u5b9a\u3057\u305f\u3051\u308c\u3070mass\u30d7\u30ed\u30d1\u30c6\u30a3\uff08\u5358\u4f4d\u306f\u30ad\u30ed\u30b0\u30e9\u30e0\uff09\u306b\u30bb\u30c3\u30c8\u3059\u308c\u3070\u3088\u3044\u3002<br \/>\n\u305d\u306e\u969b\u3001\u9006\u306bdensity\u304c\u81ea\u52d5\u3067\u518d\u8a08\u7b97\u3055\u308c\u308b\u3002<\/p>\n<p>\u3068\u3066\u3082\u697d\u3060\u3002<br \/>\n\u3057\u304b\u3057\u3001\u30dc\u30fc\u30eb\u306f\u753b\u9762\u5916\u306b\u5411\u304b\u3063\u3066\u843d\u4e0b\u3057\u7d9a\u3051\u308b\u3060\u3051\u3067\u885d\u7a81\u53cd\u5fdc\u304c\u306a\u3044\u306e\u3067\u3064\u307e\u3089\u306a\u3044\u3002<\/p>\n<h3>\u67a0\u3092\u8ffd\u52a0\u3059\u308b<\/h3>\n<p>\u30dc\u30fc\u30eb\u304c\u753b\u9762\u5916\u306b\u51fa\u306a\u3044\u3088\u3046\u3001\u67a0\u3092\u8ffd\u52a0\u3059\u308b\u3002<br \/>\n<a href=\"https:\/\/peta.okechan.net\/blog\/archives\/3068\" title=\"SpriteKit\u3092\u4f7f\u3063\u3066\u307f\u308b \u305d\u306e1\">\u524d\u56de<\/a>\u306e-(id)initWithSize:(CGSize)size\u30e1\u30bd\u30c3\u30c9\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u308b\u3002<\/p>\n<pre class=\"brush: objc; title: ; notranslate\" title=\"\">-(id)initWithSize:(CGSize)size {    \r\n    if (self = &#x5B;super initWithSize:size]) {\r\n        \/* Setup your scene here *\/\r\n        \r\n        self.backgroundColor = &#x5B;SKColor colorWithRed:0.15 green:0.15 blue:0.3 alpha:1.0];\r\n        \r\n        SKLabelNode *myLabel = &#x5B;SKLabelNode labelNodeWithFontNamed:@&quot;Chalkduster&quot;];\r\n        \r\n        myLabel.text = @&quot;Hello, World!&quot;;\r\n        myLabel.fontSize = 30;\r\n        myLabel.position = CGPointMake(CGRectGetMidX(self.frame),\r\n                                       CGRectGetMidY(self.frame));\r\n        \r\n        &#x5B;self addChild:myLabel];\r\n        \r\n        self.physicsBody = &#x5B;SKPhysicsBody bodyWithEdgeLoopFromRect:(CGRect){CGPointZero, size}];\r\n    }\r\n    return self;\r\n}<\/pre>\n<p>self.physicsBody = [SKPhysicsBody bodyWithEdgeLoopFromRect:(CGRect){CGPointZero, size}]\u306e\u884c\u3092\u8ffd\u52a0\u3057\u305f\u3060\u3051\u3067\u3042\u308b\u3002<br \/>\n\u3053\u308c\u3067\u3001\u30b7\u30fc\u30f3\u306e\u30b5\u30a4\u30ba\u3068\u540c\u3058\u30b5\u30a4\u30ba\u306e\u67a0\u304c\u751f\u6210\u3055\u308c\u3001\u30b7\u30fc\u30f3\u306ephysicsBody\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u30bb\u30c3\u30c8\u3055\u308c\u308b\u3002<br \/>\n\u3088\u3063\u3066\u3001\u30dc\u30fc\u30eb\u304c\u753b\u9762\u306e\u5916\u306b\u306f\u307f\u51fa\u3055\u306a\u304f\u306a\u308b\u3002<\/p>\n<h3>\u525b\u4f53\u306e\u7a2e\u985e<\/h3>\n<p>SKPhysicsBody\u3067\u8868\u73fe\u51fa\u6765\u308b\u525b\u4f53\u306f\u5927\u304d\u304f\u5206\u3051\u30662\u7a2e\u985e\u3042\u308b\u3002<br \/>\n\u3072\u3068\u3064\u306f\u30dc\u30ea\u30e5\u30fc\u30e0\u30d9\u30fc\u30b9\u525b\u4f53\u3067\u3001\u3082\u3046\u3072\u3068\u3064\u306f\u30a8\u30c3\u30b8\u30d9\u30fc\u30b9\u525b\u4f53\u3067\u3042\u308b\u3002<\/p>\n<p>\u30dc\u30ea\u30e5\u30fc\u30e0\u30d9\u30fc\u30b9\u525b\u4f53\u306f\u3044\u308f\u3086\u308b\u666e\u901a\u306e\u525b\u4f53\u3067\u3001\u8cea\u91cf\u3092\u6301\u3061\u3001\u4eee\u60f3\u7684\u306a\u7269\u7406\u4e16\u754c\u306e\u4e2d\u3067\u69d8\u3005\u306a\u529b\u3092\u53ca\u307c\u3057\u305f\u308a\u53d7\u3051\u305f\u308a\u3057\u3066\u79fb\u52d5\u3059\u308b\u3082\u306e\u3067\u3042\u308b\u3002<br \/>\n\u4eca\u56de\u306e\u4f8b\u3067\u306f\u3001\u3053\u308c\u306f\u30dc\u30fc\u30eb\u304c\u8a72\u5f53\u3059\u308b\u3002<br \/>\n\u30dc\u30ea\u30e5\u30fc\u30e0\u30d9\u30fc\u30b9\u525b\u4f53\u306e\u5834\u5408\u3001SKPhysicsBody\u306edynamic\u30d7\u30ed\u30d1\u30c6\u30a3\u306bNO\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3068\u52d5\u304b\u306a\u304f\u3059\u308b\u4e8b\u304c\u51fa\u6765\u308b\uff08\u9759\u6b62\u3057\u3066\u3044\u308b\u8cea\u91cf\u7121\u9650\u306e\u7269\u4f53\u306e\u3088\u3046\u306b\u306a\u308b\uff09\u3002<\/p>\n<p>\u30a8\u30c3\u30b8\u30d9\u30fc\u30b9\u525b\u4f53\u306f\u3001\u67a0\u3060\u3051\u306e\u525b\u4f53\u3067\u8cea\u91cf\u30bc\u30ed\u3067\u3042\u308a\u3001\u30dc\u30ea\u30e5\u30fc\u30e0\u30d9\u30fc\u30b9\u525b\u4f53\u306edynamic\u30d7\u30ed\u30d1\u30c6\u30a3\u306bNO\u3092\u30bb\u30c3\u30c8\u3057\u305f\u72b6\u614b\u3068\u540c\u3058\u306b\u306a\u308b\uff08\u8981\u306f\u5b8c\u5168\u306b\u52d5\u304b\u306a\u3044\u969c\u5bb3\u7269\u3068\u306a\u308b\uff09\u3002<br \/>\n\u4eca\u56de\u306e\u4f8b\u3067\u306f\u3001\u30b7\u30fc\u30f3\u306b\u8a2d\u5b9a\u3057\u305f\u67a0\u304c\u8a72\u5f53\u3059\u308b\u3002<br \/>\n\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210\u7528\u306e\u30af\u30e9\u30b9\u30e1\u30bd\u30c3\u30c9\u306b\u300cEdge\u300d\u3068\u3044\u3046\u5358\u8a9e\u304c\u542b\u307e\u308c\u308b\u3082\u306e\u306f\u30a8\u30c3\u30b8\u30d9\u30fc\u30b9\u525b\u4f53\u3092\u751f\u6210\u3059\u308b\u3002<br \/>\n\u305d\u308c\u4ee5\u5916\u306f\u30dc\u30ea\u30e5\u30fc\u30e0\u30d9\u30fc\u30b9\u525b\u4f53\u3068\u306a\u308b\u3002<\/p>\n<h3>\u6700\u5f8c\u306b<\/h3>\n<p>\u3060\u3044\u3076\u5c11\u306a\u3044\u30b3\u30fc\u30c9\u3067\u4eca\u56de\u306e\u76ee\u6a19\u3092\u9054\u6210\u3057\u305f\u304c\u3001\u30b3\u30fc\u30c9\u304c\u5c11\u306a\u304f\u3066\u6e08\u3093\u3060\u306e\u306f\u5404\u30af\u30e9\u30b9\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306b\u983c\u3063\u3066\u308b\u304b\u3089\u3067\u3082\u3042\u308b\u3002<br \/>\n\u7279\u306b\u3001SKPhysicsBody\u306e\u53cd\u767a\u529b\uff08restitution\u30d7\u30ed\u30d1\u30c6\u30a3\uff09\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u5c0f\u3055\u3059\u304e\u3066\u30dc\u30fc\u30eb\u304c\u3042\u307e\u308a\u8df3\u306d\u306a\u3044\u306e\u304c\u9762\u767d\u304f\u306a\u3044\u3002<br \/>\n\u4ed6\u306b\u3082\u6469\u64e6\u529b\u3084\u7a7a\u6c17\u62b5\u6297\u3092\u8868\u3059\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u3042\u308b\u306e\u3067\u8272\u3005\u8a66\u3057\u3066\u307f\u308b\u3068\u304a\u3082\u3057\u308d\u3044\u3060\u308d\u3046\u3002<\/p>\n<p><a href=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-15.15.01.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-15.15.01-180x300.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2013-09-20 15.15.01\" width=\"180\" height=\"300\" class=\"alignnone size-medium wp-image-3103\" srcset=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-15.15.01-180x300.png 180w, https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-15.15.01.png 594w\" sizes=\"auto, (max-width: 180px) 100vw, 180px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><a href=\"https:\/\/peta.okechan.net\/blog\/archives\/3068\" title=\"SpriteKit\u3092\u4f7f\u3063\u3066\u307f\u308b \u305d\u306e1\">\u524d\u56de<\/a>\u3001SpriteKit Game\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u751f\u6210\u3055\u308c\u305f\u30bd\u30fc\u30b9\u3092\u898b\u305f\u3002<br \/>\n\u305d\u306e\u30bd\u30fc\u30b9\u3092\u30d9\u30fc\u30b9\u306b\u3057\u3066\u3001\u4eca\u56de\u306fSpriteKit\u306e\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u3092\u5229\u7528\u3059\u308b\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u3066\u307f\u308b\u3002<\/p>\n<h3>\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u306e\u5229\u7528\u306b\u5fc5\u8981\u306a\u524d\u63d0\u77e5\u8b58<\/h3>\n<p>\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u306b\u3082\u8272\u3005\u3042\u3063\u3066\u3001\u62bd\u8c61\u5316\u306e\u65b9\u6cd5\u3082\u69d8\u3005\u3060\u3063\u305f\u308a\u69cb\u6210\u8981\u7d20\u306e\u540d\u79f0\u304c\u8272\u3005\u9055\u3063\u3066\u305f\u308a\u3068\u304b\u3042\u308b\u3068\u601d\u3046\u3051\u3069\u3001\u4e00\u822c\u7684\u306b\u306f\u4eee\u60f3\u7684\u306a\u7269\u7406\u4e16\u754c\u3092\u8868\u3059\u300c\u306a\u3093\u3068\u304b\u30ef\u30fc\u30eb\u30c9\u300d\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u3001\u525b\u4f53\u3092\u8868\u3059\u300c\u306a\u3093\u3068\u304b\u30dc\u30c7\u30a3\u300d\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u767b\u9332\u3057\u3001\u3042\u3068\u306f\u30ef\u30fc\u30eb\u30c9\u306e\u6642\u9593\u3092\u3061\u3087\u3063\u3068\u3065\u3064\u9032\u3081\u308b\u4e8b\u3067\u30b7\u30df\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u3046\u3068\u3044\u3046\u306e\u304c\u57fa\u672c\u306b\u306a\u308b\u3068\u601d\u3046\u3002<\/p>\n<p>SpriteKit\u306b\u3082\u300c\u306a\u3093\u3068\u304b\u30ef\u30fc\u30eb\u30c9\u300d\u3084\u300c\u306a\u3093\u3068\u304b\u30dc\u30c7\u30a3\u300d\u306b\u76f8\u5f53\u3059\u308b\u30af\u30e9\u30b9\u304c\u3042\u308a\u3001\u305d\u308c\u305e\u308cSKPhysicsWorld\u3068SKPhysicsBody\u3068\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u305f\u3060\u3057SpriteKit\u306e\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u306f\u3001\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u3068\u3057\u3066\u72ec\u7acb\u3057\u305f\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u306f\u306a\u304f\u3001SpriteKit\u306b\u7d71\u5408\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u4e00\u822c\u7684\u306a\u3082\u306e\u3068\u4f7f\u3044\u52dd\u624b\u304c\u9055\u3046\uff08\u30b3\u30fc\u30c9\u306e\u8a18\u8ff0\u91cf\u304c\u5c11\u306a\u304f\u3066\u6e08\u3080\uff09\u90e8\u5206\u304c\u3042\u308b\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001SKPhysicsWorld\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306f\u751f\u6210\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u3002<br \/>\n\u3068\u3044\u3046\u306e\u3082\u3001SKScene\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3059\u308b\u3068\u81ea\u52d5\u7684\u306b\u305d\u306ephysicsWorld\u30d7\u30ed\u30d1\u30c6\u30a3\u306bSKPhysicsWorld\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u30bb\u30c3\u30c8\u3055\u308c\u308b\u304b\u3089\u3067\u3042\u308b\u3002<\/p>\n<p>\u307e\u305f\u3001\u7269\u7406\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u5b9f\u884c\u3092\u6307\u793a\u3059\u308b\u30b3\u30fc\u30c9\u3082\u308f\u3056\u308f\u3056\u66f8\u304f\u5fc5\u8981\u304c\u306a\u3044\u3002\uff08\u305d\u306e\u8fba\u308a\u306f\u81ea\u52d5\u7684\u306b\u5185\u90e8\u3067\u3046\u307e\u3044\u5177\u5408\u3084\u3063\u3066\u304f\u308c\u308b\u307f\u305f\u3044\u3002\uff09<br \/>\n\u3068\u3044\u3046\u304b\u3001\u7269\u7406\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u30921\u30b9\u30c6\u30c3\u30d7\u305a\u3064\u5b9f\u884c\u3059\u308b\u3088\u3046\u306aSKPhysicsWorld\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u516c\u958b\u3055\u308c\u3066\u3044\u306a\u3044\u3002\uff08\u591a\u5206\uff09<\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3001\u4f7f\u3046\u306e\u304c\u7c21\u5358\u306a\u4ee3\u308f\u308a\u306b\u81ea\u7531\u5ea6\u306f\u4f4e\u3081\u3067\u3042\u308b\u304c\u3001\u307e\u3041\u7c21\u5358\u306a2D\u30b2\u30fc\u30e0\u306e\u4f5c\u6210\u306b\u304a\u3044\u3066\u306f\u3053\u306e\u81ea\u7531\u5ea6\u306e\u4f4e\u3055\u304c\u554f\u984c\u306b\u306a\u308b\u4e8b\u306f\u5c11\u306a\u3044\u3093\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3046\u3002<\/p>\n<p>\u3061\u306a\u307f\u306bSpriteKit\u306e\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u306fSI\u5358\u4f4d\u3092\u63a1\u7528\u3057\u3066\u3044\u308b\u3002<\/p>\n<h3>\u76ee\u6a19<\/h3>\n<p><a href=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-13.54.59.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-13.54.59-180x300.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2013-09-20 13.54.59\" width=\"180\" height=\"300\" class=\"alignnone size-medium wp-image-3085\" srcset=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-13.54.59-180x300.png 180w, https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-13.54.59.png 594w\" sizes=\"auto, (max-width: 180px) 100vw, 180px\" \/><\/a><br \/>\n\u9759\u6b62\u753b\u3060\u3068\u306a\u3093\u306e\u3053\u3063\u3061\u3083\u5206\u304b\u3089\u3093\u3051\u3069\u3001\u307e\u3041\u8981\u306f\u30bf\u30c3\u30d7\u3057\u305f\u4f4d\u7f6e\u306b\u30dc\u30fc\u30eb\u3092\u914d\u7f6e\u3057\u3001\u305d\u308c\u304c\u753b\u9762\u306e\u4e0b\u5074\u306b\u5411\u304b\u3063\u3066\u843d\u4e0b\u3059\u308b\u30a2\u30d7\u30ea\u3092\u4f5c\u308b\u3002<\/p>\n<p>\u30dc\u30fc\u30eb\u306e\u753b\u50cf\u306f\u4ee5\u4e0b\u306e\u3082\u306e\u3092\u4f7f\u3063\u3066\u3044\u308b\u3002\uff08Blender\u3067\u30dd\u30ea\u30b4\u30f3\u6570\u5c11\u306a\u3081\u3067\u4f5c\u3063\u305f\u753b\u50cf\u306a\u306e\u3067\u30ab\u30af\u30ab\u30af\u3057\u3066\u308b\u3051\u3069\u3001\u3054\u81ea\u7531\u306b\u3054\u5229\u7528\u304f\u3060\u3055\u3044\u3002\uff09<br \/>\n<a href=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/Ball.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/Ball-150x150.png\" alt=\"Ball\" width=\"150\" height=\"150\" class=\"alignnone size-thumbnail wp-image-3089\" srcset=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/Ball-150x150.png 150w, https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/Ball.png 256w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><\/p>\n<h3>\u525b\u4f53\u306e\u30b3\u30fc\u30c9<\/h3>\n<p>\u4e0a\u8a18\u306e\u3068\u304a\u308a\u3001SKPhysicsWorld\u3092\u751f\u6210\u3057\u305f\u308a\u306f\u5fc5\u8981\u3058\u3083\u306a\u3044\u306e\u3067\u3001\u3044\u304d\u306a\u308a\u525b\u4f53\u306e\u8a2d\u5b9a\u306e\u30b3\u30fc\u30c9\u304b\u3089\u306f\u3058\u3081\u308b\u3002<br \/>\n<a href=\"https:\/\/peta.okechan.net\/blog\/archives\/3068\" title=\"SpriteKit\u3092\u4f7f\u3063\u3066\u307f\u308b \u305d\u306e1\">\u524d\u56de<\/a>\u306e-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event\u30e1\u30bd\u30c3\u30c9\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u308b\u3002<\/p>\n<pre class=\"brush: objc; title: ; notranslate\" title=\"\">-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {\r\n    \/* Called when a touch begins *\/\r\n    \r\n    for (UITouch *touch in touches) {\r\n        CGPoint location = &#x5B;touch locationInNode:self];\r\n        \r\n        SKSpriteNode *sprite = &#x5B;SKSpriteNode spriteNodeWithImageNamed:@&quot;Ball&quot;];\r\n        \r\n        sprite.position = location;\r\n        \r\n        const CGFloat radius = 20.0f;\r\n        SKPhysicsBody *pbody = &#x5B;SKPhysicsBody bodyWithCircleOfRadius:radius];\r\n        sprite.physicsBody = pbody;\r\n        sprite.size = (CGSize){radius * 2, radius * 2};\r\n        \r\n        &#x5B;self addChild:sprite];\r\n    }\r\n}<\/pre>\n<p>\u91cd\u8981\u306a\u306e\u306f[SKPhysicsBody bodyWithCircleOfRadius:radius]\u306e\u90e8\u5206\u3067\u3042\u308b\u3002<br \/>\n\u3053\u308c\u306b\u3088\u3063\u3066\u3001\u534a\u5f84radius\u306e\u5186\u306e\u5f62\u3092\u3057\u305f\u525b\u4f53\u304c\u751f\u6210\u3055\u308c\u308b\u3002<br \/>\n\u3053\u306e\u5834\u5408radius\u306f20\u306a\u306e\u3067\u3001\u753b\u9762\u4e0a\u3067\u306f\u534a\u5f8420\u30dd\u30a4\u30f3\u30c8\u76f8\u5f53\u306e\u5186\u3068\u306a\u308b\u3002<\/p>\n<p>\u305d\u3057\u305f\u3089\u3001sprite.physicsBody\u306b\u525b\u4f53\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3002<\/p>\n<p>\u6700\u5f8c\u306bsprite.size\u3092\u8a2d\u5b9a\u3057\u3066\u308b\u90e8\u5206\u306f\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u3068\u306f\u7121\u95a2\u4fc2\u3067\u3001\u8a2d\u5b9a\u3057\u305f\u525b\u4f53\u306e\u30b5\u30a4\u30ba\u3068\u898b\u305f\u76ee\u306e\u30b5\u30a4\u30ba\u3092\u63c3\u3048\u308b\u305f\u3081\u306e\u884c\u3067\u3042\u308b\u3002<br \/>\nradius\u306f\u534a\u5f84\u306a\u306e\u3067\u5186\u5168\u4f53\u306e\u30b5\u30a4\u30ba\u306b\u3059\u308b\u305f\u3081\u306b2\u500d\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>\u3053\u308c\u3060\u3051\u3067\u30dc\u30fc\u30eb\u304c\u753b\u9762\u4e0b\u306b\u5411\u304b\u3063\u3066\u843d\u3061\u308b\u30a2\u30d7\u30ea\u304c\u51fa\u6765\u305f\u3002<br \/>\n\u30dc\u30fc\u30eb\u304c\u753b\u9762\u4e0b\u306b\u843d\u4e0b\u3059\u308b\u306e\u306f\u3001SKPhysicsWorld\u306egravity\u30d7\u30ed\u30d1\u30c6\u30a3\uff082\u6b21\u5143\u30d9\u30af\u30c8\u30eb\uff09\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u5730\u7403\u306e\u91cd\u529b\u3092\u8868\u3059(0.0,-9.8)\u3068\u306a\u3063\u3066\u3044\u308b\u304b\u3089\u3067\u3042\u308b\u3002<br \/>\ngravity\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u5358\u4f4d\u306f\u30e1\u30fc\u30c8\u30eb\u6bce\u79d2\u6bce\u79d2\u3067\u3042\u308b\u3002<\/p>\n<p>\u3061\u306a\u307f\u306bSpriteKit\u306b\u304a\u3044\u3066\u306f\u30011\u30dd\u30a4\u30f3\u30c8\u306f2\/3\u30bb\u30f3\u30c1\u30e1\u30fc\u30c8\u30eb\u306b\u76f8\u5f53\u3059\u308b\u307f\u305f\u3044\uff08\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3067\u660e\u8a18\u3055\u308c\u3066\u3044\u308b\u90e8\u5206\u3092\u898b\u3064\u3051\u308b\u3053\u3068\u306f\u51fa\u6765\u306a\u304b\u3063\u305f\u304c\u8a08\u6e2c\u3057\u305f\u3089\u305d\u306e\u304f\u3089\u3044\u306b\u306a\u3063\u305f\uff09\u3002<\/p>\n<p>\u525b\u4f53\u306e\u8cea\u91cf\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u306a\u3044\u304c\u3001SKPhysicsBody\u306edensity\uff08\u5bc6\u5ea6\uff09\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c1\u30ad\u30ed\u30b0\u30e9\u30e0\u6bce\u5e73\u65b9\u30e1\u30fc\u30c8\u30eb\u3068\u306a\u3063\u3066\u304a\u308a\u3001\u525b\u4f53\u306e\u30b5\u30a4\u30ba\u304b\u3089\u8cea\u91cf\u306f\u81ea\u52d5\u7684\u306b\u8a08\u7b97\u3055\u308c\u308b\u3002<br \/>\n\u8cea\u91cf\u3092\u76f4\u63a5\u6307\u5b9a\u3057\u305f\u3051\u308c\u3070mass\u30d7\u30ed\u30d1\u30c6\u30a3\uff08\u5358\u4f4d\u306f\u30ad\u30ed\u30b0\u30e9\u30e0\uff09\u306b\u30bb\u30c3\u30c8\u3059\u308c\u3070\u3088\u3044\u3002<br \/>\n\u305d\u306e\u969b\u3001\u9006\u306bdensity\u304c\u81ea\u52d5\u3067\u518d\u8a08\u7b97\u3055\u308c\u308b\u3002<\/p>\n<p>\u3068\u3066\u3082\u697d\u3060\u3002<br \/>\n\u3057\u304b\u3057\u3001\u30dc\u30fc\u30eb\u306f\u753b\u9762\u5916\u306b\u5411\u304b\u3063\u3066\u843d\u4e0b\u3057\u7d9a\u3051\u308b\u3060\u3051\u3067\u885d\u7a81\u53cd\u5fdc\u304c\u306a\u3044\u306e\u3067\u3064\u307e\u3089\u306a\u3044\u3002<\/p>\n<h3>\u67a0\u3092\u8ffd\u52a0\u3059\u308b<\/h3>\n<p>\u30dc\u30fc\u30eb\u304c\u753b\u9762\u5916\u306b\u51fa\u306a\u3044\u3088\u3046\u3001\u67a0\u3092\u8ffd\u52a0\u3059\u308b\u3002<br \/>\n<a href=\"https:\/\/peta.okechan.net\/blog\/archives\/3068\" title=\"SpriteKit\u3092\u4f7f\u3063\u3066\u307f\u308b \u305d\u306e1\">\u524d\u56de<\/a>\u306e-(id)initWithSize:(CGSize)size\u30e1\u30bd\u30c3\u30c9\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u308b\u3002<\/p>\n<pre class=\"brush: objc; title: ; notranslate\" title=\"\">-(id)initWithSize:(CGSize)size {    \r\n    if (self = &#x5B;super initWithSize:size]) {\r\n        \/* Setup your scene here *\/\r\n        \r\n        self.backgroundColor = &#x5B;SKColor colorWithRed:0.15 green:0.15 blue:0.3 alpha:1.0];\r\n        \r\n        SKLabelNode *myLabel = &#x5B;SKLabelNode labelNodeWithFontNamed:@&quot;Chalkduster&quot;];\r\n        \r\n        myLabel.text = @&quot;Hello, World!&quot;;\r\n        myLabel.fontSize = 30;\r\n        myLabel.position = CGPointMake(CGRectGetMidX(self.frame),\r\n                                       CGRectGetMidY(self.frame));\r\n        \r\n        &#x5B;self addChild:myLabel];\r\n        \r\n        self.physicsBody = &#x5B;SKPhysicsBody bodyWithEdgeLoopFromRect:(CGRect){CGPointZero, size}];\r\n    }\r\n    return self;\r\n}<\/pre>\n<p>self.physicsBody = [SKPhysicsBody bodyWithEdgeLoopFromRect:(CGRect){CGPointZero, size}]\u306e\u884c\u3092\u8ffd\u52a0\u3057\u305f\u3060\u3051\u3067\u3042\u308b\u3002<br \/>\n\u3053\u308c\u3067\u3001\u30b7\u30fc\u30f3\u306e\u30b5\u30a4\u30ba\u3068\u540c\u3058\u30b5\u30a4\u30ba\u306e\u67a0\u304c\u751f\u6210\u3055\u308c\u3001\u30b7\u30fc\u30f3\u306ephysicsBody\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u30bb\u30c3\u30c8\u3055\u308c\u308b\u3002<br \/>\n\u3088\u3063\u3066\u3001\u30dc\u30fc\u30eb\u304c\u753b\u9762\u306e\u5916\u306b\u306f\u307f\u51fa\u3055\u306a\u304f\u306a\u308b\u3002<\/p>\n<h3>\u525b\u4f53\u306e\u7a2e\u985e<\/h3>\n<p>SKPhysicsBody\u3067\u8868\u73fe\u51fa\u6765\u308b\u525b\u4f53\u306f\u5927\u304d\u304f\u5206\u3051\u30662\u7a2e\u985e\u3042\u308b\u3002<br \/>\n\u3072\u3068\u3064\u306f\u30dc\u30ea\u30e5\u30fc\u30e0\u30d9\u30fc\u30b9\u525b\u4f53\u3067\u3001\u3082\u3046\u3072\u3068\u3064\u306f\u30a8\u30c3\u30b8\u30d9\u30fc\u30b9\u525b\u4f53\u3067\u3042\u308b\u3002<\/p>\n<p>\u30dc\u30ea\u30e5\u30fc\u30e0\u30d9\u30fc\u30b9\u525b\u4f53\u306f\u3044\u308f\u3086\u308b\u666e\u901a\u306e\u525b\u4f53\u3067\u3001\u8cea\u91cf\u3092\u6301\u3061\u3001\u4eee\u60f3\u7684\u306a\u7269\u7406\u4e16\u754c\u306e\u4e2d\u3067\u69d8\u3005\u306a\u529b\u3092\u53ca\u307c\u3057\u305f\u308a\u53d7\u3051\u305f\u308a\u3057\u3066\u79fb\u52d5\u3059\u308b\u3082\u306e\u3067\u3042\u308b\u3002<br \/>\n\u4eca\u56de\u306e\u4f8b\u3067\u306f\u3001\u3053\u308c\u306f\u30dc\u30fc\u30eb\u304c\u8a72\u5f53\u3059\u308b\u3002<br \/>\n\u30dc\u30ea\u30e5\u30fc\u30e0\u30d9\u30fc\u30b9\u525b\u4f53\u306e\u5834\u5408\u3001SKPhysicsBody\u306edynamic\u30d7\u30ed\u30d1\u30c6\u30a3\u306bNO\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3068\u52d5\u304b\u306a\u304f\u3059\u308b\u4e8b\u304c\u51fa\u6765\u308b\uff08\u9759\u6b62\u3057\u3066\u3044\u308b\u8cea\u91cf\u7121\u9650\u306e\u7269\u4f53\u306e\u3088\u3046\u306b\u306a\u308b\uff09\u3002<\/p>\n<p>\u30a8\u30c3\u30b8\u30d9\u30fc\u30b9\u525b\u4f53\u306f\u3001\u67a0\u3060\u3051\u306e\u525b\u4f53\u3067\u8cea\u91cf\u30bc\u30ed\u3067\u3042\u308a\u3001\u30dc\u30ea\u30e5\u30fc\u30e0\u30d9\u30fc\u30b9\u525b\u4f53\u306edynamic\u30d7\u30ed\u30d1\u30c6\u30a3\u306bNO\u3092\u30bb\u30c3\u30c8\u3057\u305f\u72b6\u614b\u3068\u540c\u3058\u306b\u306a\u308b\uff08\u8981\u306f\u5b8c\u5168\u306b\u52d5\u304b\u306a\u3044\u969c\u5bb3\u7269\u3068\u306a\u308b\uff09\u3002<br \/>\n\u4eca\u56de\u306e\u4f8b\u3067\u306f\u3001\u30b7\u30fc\u30f3\u306b\u8a2d\u5b9a\u3057\u305f\u67a0\u304c\u8a72\u5f53\u3059\u308b\u3002<br \/>\n\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210\u7528\u306e\u30af\u30e9\u30b9\u30e1\u30bd\u30c3\u30c9\u306b\u300cEdge\u300d\u3068\u3044\u3046\u5358\u8a9e\u304c\u542b\u307e\u308c\u308b\u3082\u306e\u306f\u30a8\u30c3\u30b8\u30d9\u30fc\u30b9\u525b\u4f53\u3092\u751f\u6210\u3059\u308b\u3002<br \/>\n\u305d\u308c\u4ee5\u5916\u306f\u30dc\u30ea\u30e5\u30fc\u30e0\u30d9\u30fc\u30b9\u525b\u4f53\u3068\u306a\u308b\u3002<\/p>\n<h3>\u6700\u5f8c\u306b<\/h3>\n<p>\u3060\u3044\u3076\u5c11\u306a\u3044\u30b3\u30fc\u30c9\u3067\u4eca\u56de\u306e\u76ee\u6a19\u3092\u9054\u6210\u3057\u305f\u304c\u3001\u30b3\u30fc\u30c9\u304c\u5c11\u306a\u304f\u3066\u6e08\u3093\u3060\u306e\u306f\u5404\u30af\u30e9\u30b9\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306b\u983c\u3063\u3066\u308b\u304b\u3089\u3067\u3082\u3042\u308b\u3002<br \/>\n\u7279\u306b\u3001SKPhysicsBody\u306e\u53cd\u767a\u529b\uff08restitution\u30d7\u30ed\u30d1\u30c6\u30a3\uff09\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u5c0f\u3055\u3059\u304e\u3066\u30dc\u30fc\u30eb\u304c\u3042\u307e\u308a\u8df3\u306d\u306a\u3044\u306e\u304c\u9762\u767d\u304f\u306a\u3044\u3002<br \/>\n\u4ed6\u306b\u3082\u6469\u64e6\u529b\u3084\u7a7a\u6c17\u62b5\u6297\u3092\u8868\u3059\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u3042\u308b\u306e\u3067\u8272\u3005\u8a66\u3057\u3066\u307f\u308b\u3068\u304a\u3082\u3057\u308d\u3044\u3060\u308d\u3046\u3002<\/p>\n<p><a href=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-15.15.01.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-15.15.01-180x300.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2013-09-20 15.15.01\" width=\"180\" height=\"300\" class=\"alignnone size-medium wp-image-3103\" srcset=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-15.15.01-180x300.png 180w, https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-20-15.15.01.png 594w\" sizes=\"auto, (max-width: 180px) 100vw, 180px\" \/><\/a><\/p>\n","protected":false},"author":1,"featured_media":3103,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[473,413,156,468],"class_list":["post-3084","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-featured","tag-ios","tag-objective-c","tag-spritekit"],"_links":{"self":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/3084","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/comments?post=3084"}],"version-history":[{"count":0,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/3084\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/media\/3103"}],"wp:attachment":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/media?parent=3084"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/categories?post=3084"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/tags?post=3084"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}