<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/HasTransform/convert(direction:to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation12HasTransformPAAE7convert9direction2tos5SIMD3VySfGAI_AA6EntityCSgtF"
  },
  "title" : "convert(direction:to:)"
}
-->

# convert(direction:to:)

Converts a direction vector from the local space of the entity on which
you called this method to the local space of a reference entity.

```
@MainActor @preconcurrency func convert(direction: SIMD3<Float>, to referenceEntity: Entity?) -> SIMD3<Float>
```

## Parameters

`direction`

The direction vector given in the local space of the entity.

`referenceEntity`

The entity that defines a frame of reference. Set
this to `nil` to indicate world space.

## Return Value

The direction vector specified relative to `referenceEntity`.

---

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)