Bevy Silk
CPU driven Cloth engine for Bevy using Verlet integration.
by Félix Lescaudey de Maneville
Get started
Dependency
Add bevy_silk as a dependency in the Cargo.toml
bevy_silk = "0.1"
Or follow the main git branch
bevy_silk = { git = "https://github.com/ManevilleF/bevy_silk" }
Plugin
Add the ClothPlugin to your bevy app
use *;
use *;
Add cloth to a mesh
For a mesh to be used as cloth, add the ClothBuilder component to any entity with a Handle<Mesh> component.
Note:
TransformandGlobalTransformare also required
cloth data which will be populated automatically from the associated Handle<Mesh>.
use *;
use *;
Configuration
You can customize the global cloth physics by inserting the ClothConfig resource to your app:
use *;
use *;
ClothConfig can also be used as a component to override the global configuration.
Wind
You may add wind forces to the simulation for a more dynamic clothing effect, for each force you may choose from:
Wind::Constantfor constant wind forceWind::SinWavefor a sinwave following wind intensity with custom force and frequency.
Wind forces can be added as a resource to your app through the Winds container:
use *;
use *;
Check the flag example for simple wind effect.
Mesh utils
bevy_silk provides a plane mesh generation function rectangle_mesh useful for classic cloth uses like flags or capes
Q&A
My mesh falls immediately and infinitely when I add a Cloth component, how to fix it?
You probably didn't specify any fixed points, meaning there are no vertices anchored to your entity's GlobalTransform.
TODO list
- Wind
- Custom stick target length options
- Different stick behaviors (spring, stick, etc)
- dynamic flat normal mapping
- dynamic smooth normal mapping
- Collision support
- Cloth cutting maybe?
Examples

- Flag example
run cargo run --example flag_example --features debug
- Balloon example
run cargo run --example balloon_example --features debug
- Moving example
run cargo run --example moving_example --features debug