<!--
{
  "availability" : [
    "iOS: 17.0.0 - 18.0.0",
    "iPadOS: 17.0.0 - 18.0.0",
    "macCatalyst: 17.0.0 - 18.0.0",
    "macOS: 14.0.0 - 15.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "DockKit",
  "identifier" : "/documentation/DockKit/DockAccessory/setOrientation(_:duration:relative:)-2epe2",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "DockKit"
    ],
    "preciseIdentifier" : "s:7DockKit0A9AccessoryC14setOrientation_8duration8relativeSo10NSProgressCSo10SPVector3Da_s8DurationVSbtKF"
  },
  "title" : "setOrientation(_:duration:relative:)"
}
-->

# setOrientation(_:duration:relative:)

Sets the position of each axis of orientation to radians for pitch, yaw, and roll.

```
final func setOrientation(_ rotation: Vector3D, duration: Duration = .seconds(0), relative: Bool = false) throws -> Progress
```

## Parameters

`rotation`

The spatial framework’s Vector3D with X, Y, and Z corresponding to radians of pitch, yaw, and roll axes.

`duration`

The duration, in seconds, to reach the target orientation.

`relative`

Calculate the relative-to-current positions, if set to  `true`; otherwise, move to an absolute position.

## Return Value

An object that reports progress during the animation sequence.

## Discussion

This method works only when you disable system tracking.

> Throws: ``doc://com.apple.DockKit/documentation/DockKit/DockKitError/frameRateTooHigh`` if calling the method too frequently, or ``doc://com.apple.DockKit/documentation/DockKit/DockKitError/notSupported`` in macOS.

---

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)