Skip to content

Commit

Permalink
Remove AABB so that bevy recomputes it. Ref: bevyengine/bevy#4294 (co…
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaysavant committed Apr 3, 2024
1 parent 8384440 commit a58b282
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::{anyhow, Result};
use bevy::{pbr::NotShadowCaster, prelude::*, utils::HashMap};
use bevy::{pbr::NotShadowCaster, prelude::*, render::primitives::Aabb, utils::HashMap};
use bevy_async_task::{AsyncTaskPool, AsyncTaskStatus};
use bevy_mod_picking::{
backends::raycast::bevy_mod_raycast::markers::NoBackfaceCulling, prelude::*, PickableBundle,
Expand Down Expand Up @@ -516,15 +516,19 @@ pub fn mesh_builder_to_bundle<Params: ParametricLazyCad + Component + Clone>(

if cad_generated_mesh.is_some() {
// If mesh already exists, update it...
ent_commands.insert((
MaterialMeshBundle {
material: material_hdl.clone(),
mesh: mesh_hdl,
transform,
..Default::default()
},
CadGeneratedMeshOutlines(outlines.clone()),
));
ent_commands
.insert((
MaterialMeshBundle {
material: material_hdl.clone(),
mesh: mesh_hdl,
transform,
..Default::default()
},
CadGeneratedMeshOutlines(outlines.clone()),
))
// Remove AABB for Bevy to recompute as it wont recompute by itself...
// ref: https://github.com/bevyengine/bevy/issues/4294#issuecomment-1606056536)
.remove::<Aabb>();
} else {
// Insert a new mesh comp if does not exist...
ent_commands
Expand Down

0 comments on commit a58b282

Please sign in to comment.