<!--
{
  "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/OrbitEntityAction",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation17OrbitEntityActionV"
  },
  "title" : "OrbitEntityAction"
}
-->

# OrbitEntityAction

An action which animates the transform of an entity to revolve around a specified pivot entity.

```
struct OrbitEntityAction
```

## Overview

This action moves an entity in a circular path by gradually adjusting its local transform.
The animation starts from the entity’s initial transform, and rotates around the pivot
entity. The [`orbitalAxis`](/documentation/RealityKit/OrbitEntityAction/orbitalAxis) specifies which cartesian axis
to rotate around in world space.. The axis is resolved when the action starts to produce an axis
of rotation around the pivot entity.
The full orbit completes after the action has ended.

The example below creates an animation that orbits an entity
around the x-axis two times for five seconds.

```swift
// Create an action entity resolution to the pivot entity 
// that exists in the scene.
let pivotEntity: ActionEntityResolution = .entityNamed("pivotEntity")

// Create an action that performs an orbit around the 
// specified pivot entity.
let orbitEntityAction = OrbitEntityAction(pivotEntity: pivotEntity,
                                          revolutions: 2,
                                          orbitalAxis: [0, 1, 0],
                                          isOrientedToPath: true,
                                          isAdditive: false)

// A five second animation that plays an animation causing the entity to
// orbit around the pivot.
let orbitAnimation = try AnimationResource
    .makeActionAnimation(for: orbitEntityAction,
                         duration: 5.0,
                         bindTarget: .transform)

// Play the five second orbit animation.
entity.playAnimation(orbitAnimation)
```

> Note: Use the ``doc://com.apple.RealityKit/documentation/RealityKit/OrbitEntityAction/orbitalAxis`` to determine whether the entity
> orbits clockwise or counterclockwise.

> Important: This action directly animates the ``doc://com.apple.RealityKit/documentation/RealityKit/BindTarget/transform`` on the bound entity.
> Ensure a correct bind target is supplied when creating the animation.

> Important: For a successful orbit, ensure the translational offset between the target and pivot entity are not parallel to the orbit axis.

## Topics

### Initializers

[`init(pivotEntity: ActionEntityResolution, revolutions: Float, orbitalAxis: SIMD3<Float>, isOrientedToPath: Bool, isAdditive: Bool)`](/documentation/RealityKit/OrbitEntityAction/init(pivotEntity:revolutions:orbitalAxis:isOrientedToPath:isAdditive:))

Creates a new orbit entity action.

### Instance Properties

[`var animatedValueType: (any AnimatableData.Type)?`](/documentation/RealityKit/OrbitEntityAction/animatedValueType)

The type for the value that the action modifies over time.

[`var isAdditive: Bool`](/documentation/RealityKit/OrbitEntityAction/isAdditive)

A Boolean value that indicates whether the animation system additively blends the action’s output with the base value.

[`var isOrientedToPath: Bool`](/documentation/RealityKit/OrbitEntityAction/isOrientedToPath)

A Boolean value that indicates whether the orbiting
object updates its orientation during the animation to orient itself
along the rotation path.

[`var orbitalAxis: SIMD3<Float>`](/documentation/RealityKit/OrbitEntityAction/orbitalAxis)

A vector that describes the axis of rotation (in world space).

[`var pivotEntity: ActionEntityResolution`](/documentation/RealityKit/OrbitEntityAction/pivotEntity)

The entity that the target entity orbits around.

[`var revolutions: Float`](/documentation/RealityKit/OrbitEntityAction/revolutions)

The number of rotations to complete before stopping.

## Relationships

### Conforms To

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

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

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

---

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)