I'm trying to bind two nodes together with a fixed SKPhysicsJoint I came up with this Code:
var anchor = CGPointMake(hero.position.x + 10,hero.position.y)
var fixedJoint = [SKPhysicsJointFixed .jointWithBodyA(hero.physicsBody!, bodyB: shield.physicsBody!, anchor: anchor)]
the problem came with:
self.physicsWorld.addJoint(fixedJoint)
It gave me this error:
Cannot convert value of type '[SKPhysicsJointFixed]' to expected argument type 'SKPhysicsJoint'
Any help is appreciated.
You put the fixedJoint into an array, try this instead, omitting [ and ].
let anchor = CGPointMake(hero.position.x + 10,hero.position.y)
let fixedJoint = SKPhysicsJointFixed.jointWithBodyA(hero.physicsBody!, bodyB: shield.physicsBody!, anchor: anchor)
Note: If you are not mutating your properties make them let instead of var.