The minimum distance the body must travel for SceneKit to apply a more precise (but more costly) algorithm to detect contacts with other bodies.
- iOS 12.0+
- macOS 10.14+
- Mac Catalyst 13.0+
- tvOS 12.0+
- watchOS 5.0+
SceneKit's physics engine can employ two kinds of collision detection:
With discrete collision detection, when SceneKit simulates physics before rendering each frame (see
SCNScene), it updates the position of each physics body based on the body's velocity during that time interval, then checks to see whether the body at its new position intersects other bodies.
With continuous collision detection, SceneKit calculates the volume that will be traversed by a body during each frame, then checks to see whether that volume intersects other bodies.
This property's value defaults to
0, resulting in discrete collision detection at all times. When this value is nonzero, SceneKit applies continuous collision whenever the body travels more than the specified distance within one
Discrete collision detection offers high performance, but can lead to inaccurate results for small, fast-moving bodies. Continuous collision detection has a performance cost and works only for spherical physics shapes, but provides more accurate results.
For example, in a game involving projectiles and targets, a small projectile may pass through a target if it moves farther than the target's thickness within one time step. By setting the projectile's
continuous to match its diameter, you ensure that SceneKit always detects collisions between the projectile and other objects.