© James Goodwill and Wesley Matlock 2017

James Goodwill and Wesley Matlock, Beginning Swift Games Development for iOS, 10.1007/978-1-4842-2310-9_14

14. Collision Detection

James Goodwill and Wesley Matlock2

(1)Highlands Ranch, Colorado, USA

(2)Kansas City, Missouri, USA

Now that you have the character moving around the screen, you will now need a way to identify when the hero finds a collectible. To do this you will use Collision Detection to know when the different nodes touch one another.

Collision Detection

Now that you have the hero moving around and several collectibles for him to collect, you need to determine when your hero collides with one of them.

SceneKit uses the SCNPhysicsBody object to add physics simulations to a node. During the render ...

Get Beginning Swift Games Development for iOS: Develop 2D and 3D games Using Apple's SceneKit and SpriteKit now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.