I just want to create two circles with the same axis, and make one being controlled by touch events. In java, I just had to create two bodies and one RevoluteJoint and that was it. I am new to iOS development (so I only learnt Swift) and I would like to do the same using SpriteKit
I wrote this, but it seems like I need to manage the touch event myself. Isn't there a 'grabbable body' option so I don't have to make all the calculations by myself to make the wheel follow the user fingers, but just in rotation.
override func didMoveToView(view: SKView) {
/* Setup your scene here */
inner=SKSpriteNode(imageNamed:"inner")
outer=SKSpriteNode(imageNamed:"outer")
inner.physicsBody=SKPhysicsBody(circleOfRadius: inner.frame.size.width/2)
inner.physicsBody!.dynamic=true
inner.physicsBody!.allowsRotation=true
outer.physicsBody=SKPhysicsBody(circleOfRadius: outer.frame.size.width/2)
physicsWorld.gravity=CGVectorMake(0, 0)
addChild(inner)
addChild(outer)
var joint1=SKPhysicsJointPin.jointWithBodyA(inner.physicsBody, bodyB: outer.physicsBody, anchor: CGPoint(x: 0, y: 0))
physicsWorld.addJoint(joint1)
}