<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/HasTransform/align(_:to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation12HasTransformPAAE5align_2toSo13simd_float4x4aSgAA12GeometricPinV_AJtF"
  },
  "title" : "align(_:to:)"
}
-->

# align(_:to:)

Moves and rotates the entity by a transformation from the origin pin to the target pin.

```
@discardableResult @MainActor @preconcurrency func align(_ originPin: GeometricPin, to targetPin: GeometricPin) -> float4x4?
```

## Parameters

`originPin`

The `GeometricPin` to align. It should be one of the pins on the entity.

`targetPin`

The `GeometricPin` to align to.

## Return Value

Transformation matrix that has been applied to the `Entity`,
in the frame or reference of the parent of the `Entity`. If either pin doesn’t exist, returns `nil`.

---

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)