<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKConstraint/orient(to:offset:)-1h1tw",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SKConstraint(cm)orientToNode:offset:"
  },
  "title" : "orient(to:offset:)"
}
-->

# orient(to:offset:)

Creates a constraint that forces a node to rotate to face another node.

```
class func orient(to node: SKNode, offset radians: SKRange) -> Self
```

## Parameters

`node`

The node that should be used to orient the node that this constraint is attached to.

`radians`

An offset that is added to the [`zRotation`](/documentation/SpriteKit/SKNode/zRotation) value after it is calculated.

## Return Value

A new constraint.

## Discussion

Each time when constraints are applied, a new angle is calculated so that a line projected at this angle would point at the other node’s origin. This angle is added to the values specified in the `radians` property to create a new range. Finally, the node’s [`zRotation`](/documentation/SpriteKit/SKNode/zRotation) value is clamped to fit inside this range.

---

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)