Class

SK3DNode

3D SceneKit content drawn as a flattened sprite.

Declaration

@interface SK3DNode : SKNode

Overview

Use SK3DNode objects to incorporate 3D SceneKit content into a SpriteKit-based game. When SpriteKit renders the node, the SceneKit scene is animated and rendered first. Then this rendered image is composited into the SpriteKit scene. Use the scnScene property to specify the SceneKit scene to be rendered.

Topics

Getting Started with 3D Node

Displaying 3D Content in a SpriteKit Scene

Draw SceneKit content in a SpriteKit scene by using a 3D node.

Creating 3D Nodes

+ nodeWithViewportSize:

Creates and initializes a new 3D node.

- initWithViewportSize:

Initializes a new 3D node.

- initWithCoder:

Tells you when to initialize a 3D node that has been unarchived.

Configuring a 3D Node

viewportSize

The size of the image rendered by the node.

scnScene

The SceneKit scene to render.

pointOfView

The Scene Kit node from which the scene’s contents are viewed when rendered.

autoenablesDefaultLighting

A Boolean value that determines whether Scene Kit automatically adds lights to a scene.

Animating a 3D Node’s Content in Scene Kit

playing

A Boolean value that determines whether the scene is playing.

loops

A Boolean value that determines whether Scene Kit restarts the scene time after all animations in the scene have played.

sceneTime

The current scene time.

Projecting Points and Performing Hit-Testing

- hitTest:options:

Searches the Scene Kit scene for objects corresponding to a point in the rendered image.

- projectPoint:

Projects a point from the 3D world coordinate system of the SceneKit scene to the 2D viewport coordinate system of the SpriteKit node.

- unprojectPoint:

Unprojects a point from the SpriteKit node’s 2D viewport coordinate system to the 3D world coordinate system of the SceneKit scene.

Relationships

Inherits From

See Also

Nodes that Draw

Maximizing Node Drawing Performance

Structure your nodes for maximum performance.

SKSpriteNode

An image or solid color.

SKShapeNode

A mathematical shape that can be stroked or filled.

SKEmitterNode

A source of various particle effects.

SKLabelNode

A graphical element that draws text.

SKVideoNode

A graphical element that plays video content.

SKTileMapNode

A two-dimensional array of images.