Class

SCNLookAtConstraint

A constraint that orients a node to always point toward a specified other node.

Overview

For example, you can use a look-at constraint to ensure that a camera or spotlight always follows the movement of a game character. To attach constraints to an SCNNode object, use its constraints property.

A node points in the direction of the negative z-axis of its local coordinate system. This axis defines the view direction for nodes containing cameras and the lighting direction for nodes containing spotlights or directional lights, as well as the orientation of the node’s geometry and child nodes. When Scene Kit evaluates a look-at constraint, it updates the constrained node’s transform property so that the node’s negative z-axis points toward the constraint’s target node.

Topics

Creating a Look-At Constraint

init(target: SCNNode?)

Creates a look-at constraint for a specified target node.

Modifying a Constraint

var isGimbalLockEnabled: Bool

A Boolean value that specifies whether constrained nodes are allowed to rotate.

var target: SCNNode?

The node toward which constrained nodes will point after being reoriented.

Relationships

Inherits From

See Also

Orientation Constraints

class SCNBillboardConstraint

A constraint that orients a node to always point toward the current camera.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software