I'd like to be able to convert a RegularPolygon into a Polygon, so that I'm able to access the Vector of vertices that make up the shape. In order to create a Collider for the xpbd physics library, I need to provide a Vector of vertices that make up the shape, and as far as I'm currently aware, there's no way to access this given a RegularPolygon.
Here's an example of what I'd like to be able to do:
let base_shape: Polygon = lyon::shapes::RegularPolygon {
sides: 6,
feature: lyon::shapes::RegularPolygonFeature::Radius(
crate::PIXELS_PER_METER * BASE_STATION_SIZE,
),
..lyon::shapes::RegularPolygon::default()
}.into();
let collider = Collider::convex_hull(base_shape.points.clone()).unwrap();
Here's and example that works, but only works on Polygons:
I have a feeling that this should be possible, but I'm scratching my head as to how to make it happen. Let me know if you have any thoughts, I appreciate the time taken to hear me out and ponder my questions.
Hello,
I'd like to be able to convert a RegularPolygon into a Polygon, so that I'm able to access the Vector of vertices that make up the shape. In order to create a Collider for the xpbd physics library, I need to provide a Vector of vertices that make up the shape, and as far as I'm currently aware, there's no way to access this given a RegularPolygon.
Here's an example of what I'd like to be able to do:
Here's and example that works, but only works on Polygons:
I have a feeling that this should be possible, but I'm scratching my head as to how to make it happen. Let me know if you have any thoughts, I appreciate the time taken to hear me out and ponder my questions.