Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Adam Smith
Adam Smith
2,437 Points

SWIFT: Physics bodies for irregular shapes in spritekit

I am creating an IOS app that requires me to create a physics body around a sprite node. this sprite node is not a regular polygon. how would I go about creating an irregular shaped physics body around this spritenode

1 Answer

Reed Carson
Reed Carson
8,306 Points

you can set your physicsbody to be equal to the texture provided. something like this:

physicsBody = SKPhysicsBody(texture: SKTexture, size: CGSize)