A node that controls camera movement, zoom and rotation.
- iOS 9.0+
- macOS 10.11+
- tvOS 9.0+
- watchOS 2.0+
SKCamera object is used to specify a position in the scene that the scene can be rendered from. If a camera node is placed in the scene and the scene’s
camera property is set to the camera node, then the scene is rendered using the camera node’s properties. Because the camera is a node, it can be moved just like any other node in the scene using actions, physics, and so on. When a scene is rendered using a camera node, the following things occur:
The scene is rendered so that the camera node’s origin is placed in the middle of the scene.
In this way, a camera’s position, scale, and rotation always have the opposite effect on how the scene is rendered. For example, if the camera is moved 10 pixels to the right, then the scene is rendered as if everything else moved 10 pixels to the left. And similarly, if a camera node has an
2, then scene is rendered as if every distance was half its normal size, effectively increasing the visible area of the camera’s viewport.