<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/ClothBodyComponent",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:22RealityFoundationCloth0C13BodyComponentV"
  },
  "title" : "ClothBodyComponent"
}
-->

# ClothBodyComponent

A component that simulates an entity as a deformable cloth body, when part of a cloth simulation.

```
struct ClothBodyComponent
```

## Overview

A cloth body belongs to the simulation root defined by its closest ancestor entity with a [`ClothSimulationComponent`](/documentation/RealityKit/ClothSimulationComponent), if any.

If the same entity has a [`ModelComponent`](/documentation/RealityKit/ModelComponent), then the mesh of that component will follow the deformation of this cloth body.
As an example, you can simulate and render a cloth body by setting up your entity hierarchy as follows.

```
- scene
  - entity1 (ClothSimulationComponent)
    - entity2 (ClothBodyComponent + ModelComponent)
```

The simulated cloth body is effectively a deforming copy of the input mesh ([`ClothMeshResource`](/documentation/RealityKit/ClothMeshResource)) that it is initialized from.
This mesh is known as the simulation mesh (also known as proxy mesh) of the body, and RealityKit does not render this mesh.
In contrast, the mesh of the [`ModelComponent`](/documentation/RealityKit/ModelComponent) is rendered and is known as the visual mesh of the cloth body in this context.
Unless the mesh stored in the [`ModelComponent`](/documentation/RealityKit/ModelComponent) is a [`LowLevelMesh`](/documentation/RealityKit/LowLevelMesh), it will follow the deformation of the simulation mesh.

The simulation mesh can be the same as the visual mesh, but it is recommended to use a separate mesh.
This is because there are quality and performance aspects to consider when picking a suitable simulation mesh.
See [`mesh`](/documentation/RealityKit/ClothBodyComponent/mesh) for details.

A cloth body is effectively simulated as a cluster of constrained particles with different physical properties.
Consequently, the vertices of the simulation mesh are sometimes referred to as particles.

## Topics

### Creating a cloth body

[`init(mesh: ClothMeshResource, meshDraping: ClothPoseResource?)`](/documentation/RealityKit/ClothBodyComponent/init(mesh:meshDraping:))

Creates a new cloth body component.

[`var mesh: ClothMeshResource`](/documentation/RealityKit/ClothBodyComponent/mesh)

The (simulation) mesh of the cloth body that defines the rest pose of the body.

[`var initialMeshDraping: ClothPoseResource?`](/documentation/RealityKit/ClothBodyComponent/initialMeshDraping)

An optional pose that specifies an already draped configuration of the cloth at the start of the simulation.

### Mapping the visual mesh

[`var visualMesh: LowLevelMesh?`](/documentation/RealityKit/ClothBodyComponent/visualMesh)

The dynamically deforming visual mesh of the cloth body, which you may read but not modify.

[`var visualMeshWeights: PerClothVertexData<Float>?`](/documentation/RealityKit/ClothBodyComponent/visualMeshWeights)

Optional weights by which the visual mesh should be deformed according to the simulation mesh.

[`var materialNames: [String]`](/documentation/RealityKit/ClothBodyComponent/materialNames)

The names of the body materials used by this cloth body.

[`typealias PerVisualVertexData`](/documentation/RealityKit/ClothBodyComponent/PerVisualVertexData)

Stores per-vertex data for all visual vertices in a buffer.

[`typealias PerSimulationVertexData`](/documentation/RealityKit/ClothBodyComponent/PerSimulationVertexData)

Stores per-vertex data for all simulation vertices in a buffer.

### Controlling cloth motion

[`var motionTypes: PerClothVertexData<ClothBodyComponent.ParticleMotionType>`](/documentation/RealityKit/ClothBodyComponent/motionTypes)

Motion types for each particle in the body.

[`struct ParticleMotionType`](/documentation/RealityKit/ClothBodyComponent/ParticleMotionType)

Defines whether a particle is moved by the simulation or by the entity transform.

[`var mass: Float`](/documentation/RealityKit/ClothBodyComponent/mass)

Mass of the body as a whole, in Kg.

[`static func resetDeformation(entity: Entity)`](/documentation/RealityKit/ClothBodyComponent/resetDeformation(entity:))

Resets the deformation of the cloth body to its initial pose and motion.

### Defining target shapes

[`var targetShapes: [ClothBodyComponent.TargetShape]`](/documentation/RealityKit/ClothBodyComponent/targetShapes)

The target shapes associated with the body.

[`struct TargetShape`](/documentation/RealityKit/ClothBodyComponent/TargetShape)

Pulls particles of a cloth body toward positions in either local or simulation space.

### Applying external forces

[`var externalForces: PerClothVertexData<ClothBodyComponent.ExternalForce>`](/documentation/RealityKit/ClothBodyComponent/externalForces)

The external forces applied to the particles in the body (in Newtons).

[`struct ExternalForce`](/documentation/RealityKit/ClothBodyComponent/ExternalForce)

An external force applied to a single particle, in Newtons.

[`var inflationConstraint: ClothBodyComponent.InflationConstraint?`](/documentation/RealityKit/ClothBodyComponent/inflationConstraint-swift.property)

An optional inflation constraint for representing inflatable bodies (must be watertight).

[`struct InflationConstraint`](/documentation/RealityKit/ClothBodyComponent/InflationConstraint-swift.struct)

Configuration for an inflatable cloth body.

### Managing collisions

[`var colliderBinding: ClothBodyComponent.ColliderBinding`](/documentation/RealityKit/ClothBodyComponent/colliderBinding-swift.property)

Configuration for binding the body to a mesh collider specified by [`sourceCollider`](/documentation/RealityKit/ClothBodyComponent/ColliderBinding-swift.struct/sourceCollider).

[`struct ColliderBinding`](/documentation/RealityKit/ClothBodyComponent/ColliderBinding-swift.struct)

Binds the cloth body to an entity’s mesh collider.

[`var collisionFilters: PerClothVertexData<ClothCollisionFilter>`](/documentation/RealityKit/ClothBodyComponent/collisionFilters)

Defines the collision groups that each particle belongs to, and the mask used to determine which collision groups each particle is affected by.

[`func enableCollisions(towards: ClothCollisionGroupSet)`](/documentation/RealityKit/ClothBodyComponent/enableCollisions(towards:))

Enables one-way collisions towards the selected groups for all particles in the body.

[`func disableCollisions(towards: ClothCollisionGroupSet)`](/documentation/RealityKit/ClothBodyComponent/disableCollisions(towards:))

Disables one-way collisions towards the selected groups for all particles in the body.

## Relationships

### Conforms To

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

---

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)