问题
I don't understand how to create a joint to connect two bodies in SpriteKit. Thanks for help.
回答1:
The principle is the same for all joint types. First, create a joint connecting two bodies with some additional parameters (refer to the Sprite Kit Framework reference for details). Then add the newly created joint to the physics world:
CGPoint anchor = CGPointMake(100, 100);
SKPhysicsJointFixed* fixedJoint = [SKPhysicsJointFixed jointWithBodyA:aBody
bodyB:otherBody
anchor:anchor];
[self.scene.physicsWorld addJoint:fixedJoint];
Now smoke it!
来源:https://stackoverflow.com/questions/18931353/how-to-create-joints-in-sprite-kit-xcode