---
title: ForceEffectComponent
framework: realitykit
role: symbol
role_heading: Structure
path: realitykit/forceeffectcomponent
---

# ForceEffectComponent

A component that defines the forces that affect an entity, including custom forces that you define.

## Declaration

```swift
struct ForceEffectComponent
```

## Overview

Overview After you assign a ForceEffectComponent to an entity, the force effects in the component apply each physics update for as long as the component and force effects exist. Each ForceEffect updates sequentially while the physics system accumulates its forces. The center frame of each ForceEffect coincides with and moves alongside the entity’s position and orientation. To offset this center frame, set the position and orientation. note: You can set the simulationState parameter to ForceEffectComponent.SimulationState.pause if you want to apply forces later. Create forces Use ConstantForceEffect to apply a constant force in a direction: let constantForceEffect = ForceEffect(effect: ConstantForceEffect(strength: 1, direction: [1, 0, 0])) RealityKit provides a set of useful forces you can use with ForceEffectComponent: ConstantForceEffect ConstantRadialForceEffect DragForceEffect RadialForceEffect TurbulenceForceEffect VortexForceEffect Create custom forces To create a custom force effect, define a structure that implements ForceEffectProtocol, then create an instance of ForceEffectBase with your custom ForceEffectProtocol implementation: // CustomForce implements ForceEffectProtocol, and has a custom parameter, thrustersActive, that determines how the system applies your force to a physics body. let thrusterForce = CustomForce(thrustersActive: true) // Create an instance of ForceEffectBase using your custom force. let thursterForceEffect = ForceEffect(effect: thrusterForce) note: To apply force to a physics body with a custom ForceEffectProtocol, you must implement and apply forces in update(parameters:). Apply forces You can apply multiple forces to your entity at once by including them in ForceEffectComponent: let forceEffectComponent = ForceEffectComponent(effects: [constantForceEffect, thrusterForceEffect]) entity.components.set(forceEffectComponent)

## Topics

### Initializers

- [init(effect:)](realitykit/forceeffectcomponent/init(effect:).md)
- [init(effects:simulationState:)](realitykit/forceeffectcomponent/init(effects:simulationstate:).md)

### Instance Properties

- [effects](realitykit/forceeffectcomponent/effects.md)
- [simulationState](realitykit/forceeffectcomponent/simulationstate-swift.property.md)

### Enumerations

- [ForceEffectComponent.SimulationState](realitykit/forceeffectcomponent/simulationstate-swift.enum.md)

## Relationships

### Conforms To

- [Component](realitykit/component.md)

## See Also

### Force effect components

- [ForceEffect](realitykit/forceeffect.md)
