@@ -440,7 +440,12 @@ pub(crate) fn blueprints_check_assets_loading(
440440
441441pub ( crate ) fn blueprints_assets_loaded (
442442 spawn_placeholders : Query <
443- ( Entity , & BlueprintInfo , Option < & Transform > , Option < & Name > ) ,
443+ (
444+ Entity ,
445+ & BlueprintInfo ,
446+ Option < ( & Transform , & GlobalTransform ) > ,
447+ Option < & Name > ,
448+ ) ,
444449 (
445450 Added < BlueprintAssetsLoaded > ,
446451 Without < BlueprintAssetsNotLoaded > ,
@@ -454,7 +459,7 @@ pub(crate) fn blueprints_assets_loaded(
454459
455460 mut commands : Commands ,
456461) {
457- for ( entity, blueprint_info, transform , name) in spawn_placeholders. iter ( ) {
462+ for ( entity, blueprint_info, maybe_transform , name) in spawn_placeholders. iter ( ) {
458463 /*info!(
459464 "BLUEPRINT: all assets loaded, attempting to spawn blueprint SCENE {:?} for entity {:?}, id: {:}, parent:{:?}",
460465 blueprint_info.name, name, entity, original_parent
@@ -485,10 +490,10 @@ pub(crate) fn blueprints_assets_loaded(
485490 let scene = & blueprint_gltf. named_scenes [ main_scene_name] ;
486491
487492 // transforms are optional, but still deal with them correctly
488- let mut transforms : Transform = Transform :: default ( ) ;
489- if transform . is_some ( ) {
490- transforms = * transform . unwrap ( ) ;
491- }
493+ let ( transform , global_transform ) = match maybe_transform {
494+ Some ( ( transform , global_transform ) ) => ( * transform , * global_transform ) ,
495+ None => ( Transform :: default ( ) , GlobalTransform :: default ( ) ) ,
496+ } ;
492497
493498 let mut original_children: Vec < Entity > = vec ! [ ] ;
494499 if let Ok ( c) = all_children. get ( entity) {
@@ -516,7 +521,8 @@ pub(crate) fn blueprints_assets_loaded(
516521 commands. entity ( entity) . insert ( (
517522 SceneBundle {
518523 scene : scene. clone ( ) ,
519- transform : transforms,
524+ transform,
525+ global_transform,
520526 ..Default :: default ( )
521527 } ,
522528 OriginalChildren ( original_children) ,
0 commit comments