diff --git a/examples/2d/mesh2d_manual.rs b/examples/2d/mesh2d_manual.rs index bf9850f68d5fc..5eb72f3a19d88 100644 --- a/examples/2d/mesh2d_manual.rs +++ b/examples/2d/mesh2d_manual.rs @@ -102,15 +102,12 @@ fn star( ColoredMesh2d::default(), // The `Handle` needs to be wrapped in a `Mesh2dHandle` to use 2d rendering instead of 3d Mesh2dHandle(meshes.add(star)), - // These other components are needed for 2d meshes to be rendered - Transform::default(), - GlobalTransform::default(), - Visibility::default(), - ComputedVisibility::default(), + // This bundle's components are needed for something to be rendered + SpatialBundle::VISIBLE_IDENTITY, )); - commands - // And use an orthographic projection - .spawn(Camera2dBundle::default()); + + // Spawn the camera + commands.spawn(Camera2dBundle::default()); } /// A marker component for colored 2d meshes diff --git a/examples/animation/custom_skinned_mesh.rs b/examples/animation/custom_skinned_mesh.rs index 86f54922e291b..bc122453d6878 100644 --- a/examples/animation/custom_skinned_mesh.rs +++ b/examples/animation/custom_skinned_mesh.rs @@ -121,17 +121,14 @@ fn setup( for i in -5..5 { // Create joint entities let joint_0 = commands - .spawn(( - Transform::from_xyz(i as f32 * 1.5, 0.0, 0.0), - GlobalTransform::IDENTITY, - )) + .spawn(TransformBundle::from(Transform::from_xyz( + i as f32 * 1.5, + 0.0, + 0.0, + ))) .id(); let joint_1 = commands - .spawn(( - AnimatedJoint, - Transform::IDENTITY, - GlobalTransform::IDENTITY, - )) + .spawn((AnimatedJoint, TransformBundle::IDENTITY)) .id(); // Set joint_1 as a child of joint_0. diff --git a/examples/shader/shader_instancing.rs b/examples/shader/shader_instancing.rs index 2438c39c2b603..71e68566b40e5 100644 --- a/examples/shader/shader_instancing.rs +++ b/examples/shader/shader_instancing.rs @@ -32,8 +32,7 @@ fn main() { fn setup(mut commands: Commands, mut meshes: ResMut>) { commands.spawn(( meshes.add(Mesh::from(shape::Cube { size: 0.5 })), - Transform::from_xyz(0.0, 0.0, 0.0), - GlobalTransform::default(), + SpatialBundle::VISIBLE_IDENTITY, InstanceMaterialData( (1..=10) .flat_map(|x| (1..=10).map(move |y| (x as f32 / 10.0, y as f32 / 10.0))) @@ -44,8 +43,6 @@ fn setup(mut commands: Commands, mut meshes: ResMut>) { }) .collect(), ), - Visibility::default(), - ComputedVisibility::default(), // NOTE: Frustum culling is done based on the Aabb of the Mesh and the GlobalTransform. // As the cube is at the origin, if its Aabb moves outside the view frustum, all the // instanced cubes will be culled. diff --git a/examples/stress_tests/many_foxes.rs b/examples/stress_tests/many_foxes.rs index 0c5215fefe7a0..d67d05e5b50e0 100644 --- a/examples/stress_tests/many_foxes.rs +++ b/examples/stress_tests/many_foxes.rs @@ -111,10 +111,7 @@ fn setup( let (base_rotation, ring_direction) = ring_directions[ring_index % 2]; let ring_parent = commands .spawn(( - Transform::default(), - GlobalTransform::default(), - Visibility::default(), - ComputedVisibility::default(), + SpatialBundle::VISIBLE_IDENTITY, ring_direction, Ring { radius }, )) diff --git a/examples/stress_tests/transform_hierarchy.rs b/examples/stress_tests/transform_hierarchy.rs index c75b358459db8..a5771c81a0bef 100644 --- a/examples/stress_tests/transform_hierarchy.rs +++ b/examples/stress_tests/transform_hierarchy.rs @@ -367,11 +367,7 @@ fn spawn_tree( } // insert root - ents.push( - commands - .spawn((root_transform, GlobalTransform::default())) - .id(), - ); + ents.push(commands.spawn(TransformBundle::from(root_transform)).id()); let mut result = InsertResult::default(); let mut rng = rand::thread_rng(); @@ -417,7 +413,7 @@ fn spawn_tree( }; // only insert the components necessary for the transform propagation - cmd.insert((transform, GlobalTransform::default())); + cmd.insert(TransformBundle::from(transform)); cmd.id() };