1
votes

So guy and girls I got this sprite and i was wounding how do i create a circle physics body around it. Maybe using something with alpha.

What I currently have ball.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:ball.size];

bodyWithRectangleOfSize just puts a square over the sprite right?

1

1 Answers

2
votes

To create a circular physics body you can either use:

myNode.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:10.0];

or

myNode.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:10 center:CGPointMake(0, 0)];

You would specify a center only if you are looking for your physics body to have an offset from your node's center.