---
title: "setOrientation(_:relativeTo:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/hastransform/setorientation(_:relativeto:)"
---

# setOrientation(_:relativeTo:)

Sets the orientation of the entity relative to the given reference entity.

## Declaration

```swift
@MainActor @preconcurrency func setOrientation(_ orientation: simd_quatf, relativeTo referenceEntity: Entity?)
```

## Parameters

- `orientation`: A new orientation, relative to referenceEntity.
- `referenceEntity`: The entity that defines a frame of reference. Set this to nil to indicate world space.

## See Also

### Rotating an entity

- [orientation](realitykit/hastransform/orientation.md)
- [orientation(relativeTo:)](realitykit/hastransform/orientation(relativeto:).md)
