<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/EntityTargetValue",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:19_RealityKit_SwiftUI17EntityTargetValueV"
  },
  "title" : "EntityTargetValue"
}
-->

# EntityTargetValue

A value containing an original gesture value along with a targeted entity.

```
@dynamicMemberLookup struct EntityTargetValue<Value>
```

## Overview

Spatial data from a <doc://com.apple.documentation/documentation/SwiftUI/DragGesture/Value/location> returned by a gesture can be converted to and from the entity
using functions defined in [`RealityCoordinateSpaceConverting`](/documentation/RealityKit/RealityCoordinateSpaceConverting).

For example, here’s how to convert <doc://com.apple.documentation/documentation/SwiftUI/DragGesture/Value/location> from a
<doc://com.apple.documentation/documentation/SwiftUI/DragGesture> to the parent of an [`Entity`](/documentation/RealityKit/Entity):

```swift
DragGesture(coordinateSpace: .global).targetedToEntity().updating($state) { state, value, _ in
    let location = value.convert(
        value.location, from: .global, to: value.entity.parent
    )
    ...
}
```

## Topics

### Accessing gesture info

[`var entity: Entity`](/documentation/RealityKit/EntityTargetValue/entity)

The targeted entity.

[`var gestureValue: Value`](/documentation/RealityKit/EntityTargetValue/gestureValue)

The gesture value updated by the gesture.

[`subscript<T>(dynamicMember _: KeyPath<Value, T>) -> T`](/documentation/RealityKit/EntityTargetValue/subscript(dynamicMember:))

### Instance Methods

[`func unproject(CGPoint, from: some CoordinateSpaceProtocol, to: some RealityCoordinateSpace) -> SIMD3<Float>?`](/documentation/RealityKit/EntityTargetValue/unproject(_:from:to:))

Unproject `point` from a 2D coordinate space into 3D world coordinates.

[`func unproject(KeyPath<Value, CGPoint>, to: some RealityCoordinateSpace) -> SIMD3<Float>?`](/documentation/RealityKit/EntityTargetValue/unproject(_:to:))

Unproject a 2D point from the gesture value into 3D world coordinates.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`Escapable`](/documentation/Swift/Escapable)

[`RealityCoordinateSpaceProjecting`](/documentation/RealityKit/RealityCoordinateSpaceProjecting)

[`RealityCoordinateSpaceConverting`](/documentation/RealityKit/RealityCoordinateSpaceConverting)

[`Copyable`](/documentation/Swift/Copyable)

---

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)