<!--
{
  "availability" : [
    "iOS: 8.0.0 - 26.0.0",
    "iPadOS: 8.0.0 - 26.0.0",
    "macCatalyst: 13.1.0 - 26.0.0",
    "macOS: 10.8.0 - 26.0.0",
    "tvOS: 9.0.0 - 26.0.0",
    "visionOS: 1.0.0 - 26.0.0",
    "watchOS: 3.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SceneKit",
  "identifier" : "/documentation/SceneKit/SCNTransformConstraint/init(inWorldSpace:with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SceneKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SCNTransformConstraint(cm)transformConstraintInWorldSpace:withBlock:"
  },
  "title" : "init(inWorldSpace:with:)"
}
-->

# init(inWorldSpace:with:)

Creates a new transform constraint.

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

## Parameters

`world`

<doc://com.apple.documentation/documentation/Swift/true> to evaluate the constraint in the scene’s world coordinate space, or <doc://com.apple.documentation/documentation/Swift/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`](/documentation/SceneKit/SCNNode/transform) property of the constrained node’s [`presentation`](/documentation/SceneKit/SCNNode/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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)