当我尝试使用 SKPhysicsJointFixed 加入两个 SKSpriteNode 时,它们会分开,就好像根本没有连接一样。我所做的一切似乎都不起作用。这是我的代码...
CGPoint position = CGPointMake(100, 100);
CGSize size = CGSizeMake(4, 64);
SKSpriteNode *node1 = [SKSpriteNode spriteNodeWithColor:[SKColor whiteColor] size:size];
node1.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:size];
node1.position = position;
SKSpriteNode *node2 = [SKSpriteNode spriteNodeWithColor:[SKColor whiteColor] size:size];
node2.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:size];
node2.position = position;
[scene addChild:node1];
[scene addChild:node2];
SKPhysicsJointFixed *joint = [SKPhysicsJointFixed jointWithBodyA:node1.physicsBody
bodyB:node2.physicsBody
anchor:CGPointMake(100, 100)];
[scene.physicsWorld addJoint:joint];
提前致谢。