Crates.io | bevy_clay_tiles |
lib.rs | bevy_clay_tiles |
version | |
source | src |
created_at | 2024-08-19 13:48:55.70307 |
updated_at | 2024-12-09 17:47:16.32813 |
description | A procedural-mesh building system for bevy |
homepage | |
repository | https://github.com/ethereumdegen/bevy_clay_tiles |
max_upload_size | |
id | 1343888 |
Cargo.toml error: | TOML parse error at line 22, column 1 | 22 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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()
} );
} );
}
}