Returns the texture coordinates at the point of intersection for the specified texture mapping channel.
- iOS 8.0+
- macOS 10.8+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 3.0+
The index of the mapping channel in which to look up texture coordinates.
The texture coordinates at the point of intersection, or
CGPoint if the geometry does not have a texture coordinate source for the specified channel.
SCNGeometry object can contain multiple sources of texture coordinates, or texture mapping channels. (With multiple channels, you can map texture images for different material properties in different ways.) To use the texture coordinates of a hit-test result, specify which texture coordinate source to look up coordinates in.
For example, to add “scorch marks” to a game character hit by a laser, you might modify a texture image mapped to the
multiply property of the geometry’s material. Use the
mapping index from that material property as the
channel parameter when calling
texture to ensure that you modify the correct location in the texture image.