I need the AABB of a loaded scene, however, when query for it, the scene does not seem to have an AABB component. I'm not sure where to start debugging. Maybe a load order issue? Or do some scenes fail to have an AABB component?
fn selection_system(
...
transforms: Query<(&Transform, &Aabb)>,
) {
if cursor.selection.just_selected {
create_selection_confirmation_outline(
&mut commands,
&cursor,
&cursor.settings.aesthetics,
&mut meshes,
&mut materials,
);
for entity in query.iter_mut() {
match transforms.get(entity) {
Ok((transform, aabb)) => {
...
}
Err(_) => println!("Failed to get extents."),
...
}
Here's loading the scene:
commands
.spawn((SceneBundle {
scene: asset_server.load("scp-096/scene.gltf#Scene0"),
transform: Transform {
translation: Vec3::new(4.4, 0.0, 3.0),
..Default::default()
},
..default()
},))
.insert(Pickable)
.insert(Name::new("scp-096"));
Full project's on Github:
https://github.com/Ladvien/bevy_rts_cursor/blob/main/examples/scene_base.rs