I am trying to connect together two SKNodes
which both have equal size circular physics bodies. They are positioned so as to be touching each other, and I want them to be locked together. From the documentation, it sounds like I want a SKPhysicsJointFixed
, and I have tried creating one with the anchor point being the midpoint between the two nodes - like this:
let fixedJoint = SKPhysicsJointFixed.joint(withBodyA: atom1.physicsBody!, bodyB: atom2.physicsBody!, anchor:midPoint)
but this causes an odd behaviour where after the joint is made the top node falls through the bottom node - where before the joint existed the physicsbodies rested against each other.
If I use a pin joint instead with the same code - it works as expected ie:
let pinJoint = SKPhysicsJointPin.joint(withBodyA: atom1.physicsBody!, bodyB: atom2.physicsBody!, anchor:midPoint)
locks the bodies together as I want them to be. I guess this is a perfectly fine solution - but I'm confused something about what is going on. Why does my pin joint do what I thought the fixed joint would do, and why does the fixed joint not do what I thought it would?