Contents

ClothColliderComponent

A component that adds a cloth-compatible collider to an entity.

Declaration

struct ClothColliderComponent

Overview

A cloth collider belongs to the simulation root defined by its closest ancestor entity with a ClothSimulationComponent, if any.

By default, a collider ensures that cloth bodies (ClothBodyComponent) stay outside of its shape. Colliders can also report when such collisions occur. Colliders themselves are not simulated and are (unlike bodies) not affected by bodies or by other colliders.

As an example, you can simulate and render a cloth body together with a collider by setting up your entity hierarchy as follows.

- scene
  - rootEntity (ClothSimulationComponent)
    - dressEntity (ClothBodyComponent + ModelComponent)
    - characterEntity (ClothColliderComponent + ModelComponent)

The shape of a collider can either be a mesh or an implicit shape. All implicit shapes are mutable at runtime. The mesh shape is directly mutable at runtime only if it is a LowLevelMesh. When suitable, it is recommended to use colliders with implicit shapes for improved performance.

If the shape of a collider is a mesh and the same entity has a ModelComponent, then the two meshes will attempt to stay in sync. In this context, the mesh of the collider and the ModelComponent would be known as the simulation mesh and visual mesh, respectively. In particular:

  • if both meshes are LowLevelMesh, then they will not stay in sync at all.

  • if only the simulation mesh is a LowLevelMesh, then the visual mesh will follow the simulation mesh.

  • otherwise, the simulation mesh will follow the visual mesh (regardless if it is a LowLevelMesh).

Topics

Creating a cloth collider

Configuring the collider shape

Managing collision response

Instance Properties

See Also

Collision