<!--
{
  "availability" : [
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "TabletopKit",
  "identifier" : "/documentation/TabletopKit/EntityEquipment",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "TabletopKit",
      "RealityKit"
    ],
    "preciseIdentifier" : "s:020_TabletopKit_RealityB015EntityEquipmentP"
  },
  "title" : "EntityEquipment"
}
-->

# EntityEquipment

A protocol for equipment in a game that you render using RealityKit.

```
protocol EntityEquipment : Equipment
```

## Overview

To render equipment using an entity, follow these steps:

1. Create a structure that conforms to this protocol.
2. Depending on the type of equipment, set the [`State`](/documentation/TabletopKit/Equipment/State) type alias to either
   [`BaseEquipmentState`](/documentation/TabletopKit/BaseEquipmentState), [`DieState`](/documentation/TabletopKit/DieState), or [`CardState`](/documentation/TabletopKit/CardState).
3. Declare the `id` property as a [`EquipmentIdentifier`](/documentation/TabletopKit/EquipmentIdentifier) structure.
4. Declare the [`initialState`](/documentation/TabletopKit/Equipment/initialState) property as a [`State`](/documentation/TabletopKit/Equipment/State) structure.
5. Implement an initializer that sets these properties and the [`entity`](/documentation/TabletopKit/EntityEquipment/entity) property.

```swift
struct Piece: EntityEquipment {
    typealias State = BaseEquipmentState

    var id: EquipmentIdentifier
    var entity: Entity
    var initialState: State

    @MainActor
    init(index: Int = 0, position: TableVisualState.Point2D) {
        id = .piece(index)
        entity = try! ModelEntity.load(named: "chess/queen", in: contentBundle)
        initialState = State(parentID: .table, pose: .init(position: position, rotation: .init()), entity: entity)
    }
}
```

Optionally, implement the [`layoutChildren(for:visualState:)`](/documentation/TabletopKit/Equipment/layoutChildren(for:visualState:)) method for equipment that represents groups, and the [`restingOrientation(state:)`](/documentation/TabletopKit/Equipment/restingOrientation(state:)) method to provide a custom resting position. For example, implement the [`restingOrientation(state:)`](/documentation/TabletopKit/Equipment/restingOrientation(state:)) method to flip a card face down in a card game:

```swift
func restingOrientation(state: State) -> Rotation3D {
    state.faceUp ? .identity : .init(angle: .init(degrees: +180), axis: .init(x: 0, y: 0, z: 1))
}
```

## Topics

### Displaying the equipment

[`var entity: Entity`](/documentation/TabletopKit/EntityEquipment/entity)

The entity associated with the equipment.

## Relationships

### Inherits From

[`Equipment`](/documentation/TabletopKit/Equipment)

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

---

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)