From 611f8445335e290e2f478e8eb541afa1fb0fae60 Mon Sep 17 00:00:00 2001 From: Joona Aalto Date: Fri, 2 Feb 2024 00:36:19 +0200 Subject: [PATCH] Fix index buffer capacity --- crates/bevy_render/src/mesh/primitives/dim2.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_render/src/mesh/primitives/dim2.rs b/crates/bevy_render/src/mesh/primitives/dim2.rs index 00cfe3358fbc1..9578dee5a27de 100644 --- a/crates/bevy_render/src/mesh/primitives/dim2.rs +++ b/crates/bevy_render/src/mesh/primitives/dim2.rs @@ -314,7 +314,7 @@ impl Capsule2dMeshBuilder { let vertex_count = 2 * self.resolution; // Six extra indices for the two triangles between the hemicircles - let mut indices = Vec::with_capacity((vertex_count - 2) * 3 + 6); + let mut indices = Vec::with_capacity((self.resolution - 2) * 2 * 3 + 6); let mut positions = Vec::with_capacity(vertex_count); let normals = vec![[0.0, 0.0, 1.0]; vertex_count]; let mut uvs = Vec::with_capacity(vertex_count);