---
title: OrbitEntityAction
framework: realitykit
role: symbol
role_heading: Structure
path: realitykit/orbitentityaction
---

# OrbitEntityAction

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

## Declaration

```swift
struct OrbitEntityAction
```

## Overview

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 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. // 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 orbitalAxis to determine whether the entity orbits clockwise or counterclockwise. important: This action directly animates the 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:revolutions:orbitalAxis:isOrientedToPath:isAdditive:)](realitykit/orbitentityaction/init(pivotentity:revolutions:orbitalaxis:isorientedtopath:isadditive:).md)

### Instance Properties

- [animatedValueType](realitykit/orbitentityaction/animatedvaluetype.md)
- [isAdditive](realitykit/orbitentityaction/isadditive.md)
- [isOrientedToPath](realitykit/orbitentityaction/isorientedtopath.md)
- [orbitalAxis](realitykit/orbitentityaction/orbitalaxis.md)
- [pivotEntity](realitykit/orbitentityaction/pivotentity.md)
- [revolutions](realitykit/orbitentityaction/revolutions.md)

## Relationships

### Conforms To

- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [EntityAction](realitykit/entityaction.md)

## See Also

### Built-in actions

- [BillboardAction](realitykit/billboardaction.md)
- [EmphasizeAction](realitykit/emphasizeaction.md)
- [FromToByAction](realitykit/fromtobyaction.md)
- [ImpulseAction](realitykit/impulseaction.md)
- [PlayAnimationAction](realitykit/playanimationaction.md)
- [PlayAudioAction](realitykit/playaudioaction.md)
- [SetEntityEnabledAction](realitykit/setentityenabledaction.md)
- [SpinAction](realitykit/spinaction.md)
