Build a rotating mill with Sprite Kit physics

Building a rotating mill for your game with SKPhysics and SKPhysicsJointPin. Here is the class code for a simple physical mill like in this video

The class can be called like this

The „game“-argument should be your SKScene object where the mill would be added. The „pos“-argument sets the position of the whole thing. „speed“ is the duration that is needed for on full rotation. The „rotateDirection“-argument can be „right“ or „left“

The physic bodies are arranged with four bodies connected with a SKPinJoint in the middle.

iOS Simulator Bildschirmfoto 29.08.2014 00.44.51

 

This is the complete class code to generate this mills:

 

One thought on “Build a rotating mill with Sprite Kit physics

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

*
*
Website