---
title: ClothSimulationComponent
framework: realitykit
role: symbol
role_heading: Structure
path: realitykit/clothsimulationcomponent
---

# ClothSimulationComponent

A component that marks an entity as the simulation root of a localized cloth simulation.

## Declaration

```swift
struct ClothSimulationComponent
```

## Overview

Overview Each entity in a scene belongs to at most one cloth simulation, which is the ancestor closest in the entity hierarchy with a ClothSimulationComponent. Separate simulations do not interact with each other, which can improve power and performance. As an example, if you want two cloth simulations, then you can set up your entity hierarchy as follows. - scene   - entity1 (ClothSimulationComponent)     - entity2 (ClothBodyComponent)   - entity3 (ClothSimulationComponent)     - entity4 (ClothBodyComponent)     - entity5       - entity6 (ClothColliderComponent) In the above example, entity1 is the root of a cloth simulation and entity2 is part of that simulation. Similarly, entity3 is the root of a different cloth simulation that entity4, entity5, and entity6 are all part of. The simulation component itself mainly configures the quality, performance, and pace of the simulation. The solver and time step together balance the quality vs. performance of the simulation. You can guide the pace of the simulation by controlling its target clock (targetClock). Meanwhile, you can also follow the pace of the simulation by syncing with its simulation clock (simulationClock). The simulation component also stores various parameters that affect the entire simulation, like gravity. Notably, it stores the collection of runtime-modifiable materials that are available to its bodies (ClothBodyComponent) and colliders (ClothColliderComponent). The exact interactions between these materials can be further configured through the simulation’s friction overrides.

## Topics

### Creating a cloth simulation

- [init(solver:)](realitykit/clothsimulationcomponent/init(solver:).md)

### Configuring the solver

- [solver](realitykit/clothsimulationcomponent/solver-swift.property.md)
- [ClothSimulationComponent.Solver](realitykit/clothsimulationcomponent/solver-swift.struct.md)

### Applying forces

- [gravity](realitykit/clothsimulationcomponent/gravity.md)
- [wind](realitykit/clothsimulationcomponent/wind.md)
- [dampingFactor](realitykit/clothsimulationcomponent/dampingfactor.md)

### Assigning materials

- [materials](realitykit/clothsimulationcomponent/materials.md)
- [ClothSimulationComponent.MaterialCollection](realitykit/clothsimulationcomponent/materialcollection.md)
- [ClothSimulationComponent.Material](realitykit/clothsimulationcomponent/material.md)

### Overriding friction

- [frictionOverrides](realitykit/clothsimulationcomponent/frictionoverrides.md)
- [ClothSimulationComponent.FrictionOverridesCollection](realitykit/clothsimulationcomponent/frictionoverridescollection.md)

### Controlling simulation timing

- [timeStep](realitykit/clothsimulationcomponent/timestep.md)
- [maximumStepsPerUpdate](realitykit/clothsimulationcomponent/maximumstepsperupdate-swift.property.md)
- [ClothSimulationComponent.MaximumStepsPerUpdate](realitykit/clothsimulationcomponent/maximumstepsperupdate-swift.struct.md)
- [speedLimit](realitykit/clothsimulationcomponent/speedlimit-swift.property.md)
- [ClothSimulationComponent.SpeedLimit](realitykit/clothsimulationcomponent/speedlimit-swift.struct.md)
- [meshCollidersUpdateInterval](realitykit/clothsimulationcomponent/meshcollidersupdateinterval.md)

### Synchronizing the clock

- [targetClock](realitykit/clothsimulationcomponent/targetclock.md)
- [simulationClock](realitykit/clothsimulationcomponent/simulationclock.md)

### Initializers

- [init()](realitykit/clothsimulationcomponent/init().md)

## Relationships

### Conforms To

- [Component](realitykit/component.md)

## See Also

### Simulation and bodies

- [ClothBodyComponent](realitykit/clothbodycomponent.md)
- [ClothBodyMaterial](realitykit/clothbodymaterial.md)
- [ClothGrabComponent](realitykit/clothgrabcomponent.md)
- [ClothForceVolumeComponent](realitykit/clothforcevolumecomponent.md)
- [ClothQueryVolumeComponent](realitykit/clothqueryvolumecomponent.md)
- [ClothCoordinateSpace](realitykit/clothcoordinatespace.md)
- [PerClothVertexData](realitykit/perclothvertexdata.md)
