Searches for physics bodies along a line segment between two points in the physics world.
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 3.0+
An endpoint of the line segment to search, specified in the scene’s world coordinate system.
The other endpoint of the line segment to search, specified in the scene’s world coordinate system.
A dictionary of options affecting the test, or
nilto use default options. For applicable keys and the possible values, see Physics Test Options Keys.
An array of
SCNHit objects describing search results.
Use this method to implement concepts such as line of sight in your app. For example, in a game you might implement behavior for an enemy character by searching for physics bodies along a line between the enemy character’s position and the player character’s position, as illustrated below: