SpriteKit - drawing circles containing other circles with physics body

I am new to Objective-C and I am trying to make a simple spriteKit game which contains a circle and a ball inside it. I want to move the ball around in this circle as well on the iPhone movement. So far I have created the circle and am able to put the ball on the screen.

My problem is that I am not sure the ball is actually inside the circle or on top of it. When I attach a physics body on the ball, it drops out of the screen and does not stop on the circle's bottom edge. I am using SKShapeNode for both the circle and ball.

Please help me to provide the right documentation to go through or a little piece of code that can resolve this.


You need to assign appropriate physics bodies to your nodes. See Simulating Physics in the Sprite Kit Programming Guide.

From your description, it sounds like you need to create the outter circle's physics body with the bodyWithEdgeLoopFromPath: method (and provide a path representing the circle). Note that an edge loop physics body is not dynamic and can only collide with volume-based bodies.

The inner balls physics body can be created with bodyWithCircleOfRadius:.

Need Your Help

How to get the value that is passed to Runtime.getRuntime.exit(value) in a JUnit test case

java junit runtime runtime.exec

I have to write a Test case in JUnit for a Class lets call it C1 which internally calls Runtime.getRuntime.exit(somevalue).

EWS API ExchnageWebServices Update() method on Contacts

c# exchange-server exchangewebservices ews-managed-api

Will updating just a few Contact properties like say "JobTitle" for a single Contact object using EWS Managed API will overwrite the whole Contact and just set a JobTitle properti or will it just u...