Unprojects a point from the SpriteKit node’s 2D viewport coordinate system to the 3D world coordinate system of the SceneKit scene.
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 3.0+
A point in the SpriteKit node’s coordinate system.
The corresponding point in the world coordinate system of the SceneKit scene.
The z-coordinate of the
point parameter describes the depth at which to unproject the point relative to the near and far clipping planes of the viewing frustum (defined by the
SK3DNode property). Unprojecting a point whose z-coordinate is
0 returns a point on the near clipping plane; unprojecting a point whose z-coordinate is
1 returns a point on the far clipping plane.
A point in the SpriteKit node’s 2D viewport coordinate space can refer to any point along a line segment in the 3D SceneKit coordinate space. To test for scene contents along this line—for example, to find the geometry corresponding to a touch event—use the
The following code shows how you might convert the location of an iOS touch event inside an
node, to the 3D coordinates within its SceneKit scene. The resulting value,
scene, is given a
0, meaning that the coordinate is midway between the near and far clipping planes. You could use this value to set the position of an object within the SceneKit scene.