Contents

init(inWorldSpace:with:)

Creates a new transform constraint.

Declaration

convenience init(inWorldSpace world: Bool, with block: @escaping (SCNNode, SCNMatrix4) -> SCNMatrix4)
convenience init(inWorldSpace world: Bool, with block: @escaping (SCNNode, SCNMatrix4) -> SCNMatrix4)

Parameters

  • world:

    True to evaluate the constraint in the scene’s world coordinate space, or False to evaluate it relative to the local coordinate space of each constrained node.

  • block:

    A block to be called when Scene Kit evaluates the constraint.

    The block takes the following parameters:

    node

    The constrained node.

    transform

    The constrained node’s current presentation transformation—the value of the Transform property of the constrained node’s Presentation object. If the node is affected by an in-progress animation, this value reflects the currently visible state of the node during the animation (rather than its target state that will be visible when the animation completes).

    The block returns a transformation matrix, which Scene Kit then applies to the node. If you return the transform value passed to the block, your constraint has no effect on the node.

Return Value

A constraint object.

Discussion

The world parameter determines the coordinate space of the transformations passed to and returned by the block parameter.