bevyengine / bevyengine/bevy

Extrudable not implemented for Polygons

Open
#15,255 10 comments 0 reactions 0 assignees View on GitHub
A-Math C-Feature D-Modest S-Ready-For-Implementation X-Uncontroversial
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

Hi,

Beginner Rust and Bevy developer here!

I don't see why RegularPolygons are extrudable and Polygons are not extrudable https://docs.rs/bevy/latest/bevy/render/mesh/trait.Extrudable.html

The code below does not work with the following error message:
```
the trait From>> is not implemented for bevy::prelude::Mesh, which is required by bevy::prelude::Extrusion>: Into
```

```rs
fn spawn_polygon(
mut commands: Commands,
mut materials: ResMut>,
mut meshes: ResMut>,
) {
let points2d = vec!
[
vec2(-6., 2.),
vec2(-2., 4.),
vec2(-3., 5.)
];
let p = Polygon::new(points2d);
let e = Extrusion::new(p, 2.0);
let mesh_handle: Handle = meshes.add(e);

commands.spawn((
PbrBundle {
mesh: mesh_handle,
material: materials.add(StandardMaterial {
base_color: Srgba::hex("#ffd891").unwrap().into(),
..default()
}),
..default()
},
Cube,
));
}
```

I want to be able to create custom polygons and extrude them, not sure why this is not possible at the moment?
Happy to help implement this with some guidance :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.