| Crates.io | bevy_clay_tiles |
| lib.rs | bevy_clay_tiles |
| version | 0.16.1 |
| created_at | 2024-08-19 13:48:55.70307+00 |
| updated_at | 2025-05-28 19:34:58.671903+00 |
| description | A procedural-mesh building system for bevy |
| homepage | |
| repository | https://github.com/ethereumdegen/bevy_clay_tiles |
| max_upload_size | |
| id | 1343888 |
| size | 256,136 |
Paint tiles and walls within a constrained+layered 2D grid system and they are extruded to 3D meshes for 3D games. This is meant to be useful for blocking out levels.
(Inspired by DreamerTalin)
cargo add bevy_clay_tiles
cargo run --example basic
In the tile_types config, for each 'tile type' you can set:
the texture index used for diffuse texture
texture UV expansion factor (stretch material)
color tint of the diffuse texture
When creating the clay tiles, you can use either a Rectangle paint mode or a Polygon paint mode, similar to the Rectangle or Polygon select tools in typical photo editor softwares.
The edit mode allows you to control:
the Y height offset of created tiles
the height scale that new tiles will be extruded up to
the tile type index (see the Config section and tile_types.ron)
the default parent entity for the tile meshes when created
When clay tiles blocks spawn, they will not have a material on them, only a component ClayTileMaterial { material_name: String }. Therefore it is your responsibility to replace the component with your own material handle. The example use the BevyMaterialTool to help with this but you can just insert a Handle
fn add_material_handles(
mut commands:Commands,
block_query: Query<(Entity, &ClayTileMaterial), Added<ClayTileMaterial>>
){
for (tile_entity, tile_material_comp) in block_query.iter(){
let material_name = &tile_material_comp.material_name;
commands.get_entity(tile_entity).map( |mut cmd| {
cmd.remove::<ClayTileMaterial>( );
cmd.insert( MaterialOverrideComponent {
material_override: material_name.clone()
} );
} );
}
}