Trying to follow the Chess Game tutorial, while updating certain functionality to work with Bevy 0.10. As I understand it, the recommended way to import new models is with SceneBundles. As such I modified the spawn_piece functions to work like so.
fn create_pieces(
mut commands: Commands,
asset_server: Res<AssetServer>,
mut materials: ResMut<Assets<StandardMaterial>>
) {
let bishop_handle: Handle<Scene> =
asset_server.load("models/pieces.glb#Mesh6/Primitive0");
spawn_bishop(
&mut commands,
white_material.clone(),
bishop_handle.clone(),
Vec3::new(0., 0., 2.),
);
}
pub fn spawn_bishop(
commands: &mut Commands,
material: Handle<StandardMaterial>,
mesh: Handle<Scene>,
position: Vec3,
) {
commands.spawn(PbrBundle {
transform: Transform::from_translation(position),
..default()
})
.with_children(|parent| {
parent.spawn(SceneBundle {
scene: mesh,
transform: {
let mut transform = Transform::from_translation(Vec3::new(-0.1, 0., 0.));
transform.scale *= Vec3::new(0.2, 0.2, 0.2);
transform
},
..default()
});
});
}