Sprite Kit pin joints appear to have an incorrect anchor

I also had this issue and the cause is setting the physics body before setting the sprites position.

carNode.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:carNode.size];
carNode.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));

Change the above to

carNode.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));
carNode.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:carNode.size];

It should work. Thanks Smick.

SpriteKit: How to create Basic Physics Joints

Leave a Comment