SKSpriteNode のphysicsBody のカスタム エッジ パスを作成しています。
CGMutablePathRef edgePath = CGPathCreateMutable();
CGPathMoveToPoint(edgePath, NULL, -100, -70);
CGPathAddLineToPoint(edgePath, NULL, -100, 40);
CGPathAddLineToPoint(edgePath, NULL, -80, -20);
CGPathAddLineToPoint(edgePath, NULL, 30, -20);
CGPathAddLineToPoint(edgePath, NULL, 100, 100);
CGPathAddLineToPoint(edgePath, NULL, 100, -70);
CGPathCloseSubpath(edgePath);
次のコードを使用してphysicsBodyを割り当てようとしました:
sprite.physicsBody = [SKPhysicsBody bodyWithEdgeLoopFromPath:edgePath];
sprite.physicsBody = [SKPhysicsBody bodyWithPolygonFromPath:edgePath];
sprite.physicsBody = [SKPhysicsBody bodyWithEdgeChainFromPath:edgePath];
これらのどれも、スプライトが重力の影響を受けることを可能にしません。
ただし、単純なものを使用するとbodyWithCircleOfRadius:
、スプライトは重力の影響を受けます。
なぜこれが起こるのか、誰かが光を当てることができますか?