Replies: 1 comment
-
Answered my own questions after a night's rest 😜 :
fn debug_scene(
q_toplevel_parent: Query<(&bevy_scene::SceneInstance, &Children, Entity)>,
q_any_parent: Query<(&Children, Entity)>,
q_has_aabb: Query<Entity, With<bevy_render::primitives::Aabb>>,
mut commands: Commands,
) {
if let Ok((_, children, parent_ent)) = q_toplevel_parent.get_single() {
let mut stack = Vec::new();
let mut descendents = Vec::new();
for &child_ent in children.iter() {
stack.push(child_ent);
while stack.len() > 0 {
let it = stack.pop().unwrap();
descendents.push(it);
if let Ok((cs,p)) = q_any_parent.get(it) {
for c in cs.iter() { stack.push(*c) };
}
}
}
info!("total descendents: {}", descendents.len());
for &d in descendents.iter() {
if let Ok(ent) = q_has_aabb.get(d) {
info!("descendent has aabb");
commands.entity(ent).insert(ShowAabbGizmo::default());
}
}
}
} This helped me confirm there is something wrong with the AABB calculation but the frustum culling is correct! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm observing what appears to be a frustum culling bug on an imported gltf scene. This lead me to digging into some internals.
I wanted to add
ShowAabbGizmo
but it doesn't work. I suspect that is because theSceneRoot
component does not have aMesh3d
so an AABB is never added to it. That's where I wanted to dive in and see how I could interact with the Scene's inner world, or even easier: pull all of it's contents out into the main world. That might even be what's being done when it is spawned but after an hour of reading through source code I cannot tell.So that lead me to a few general questions out of curiosity:
Scene
store it's ownWorld
recursively as a child in the mainWorld
?bevy_render
and/or the extraction process take this into account? And if not, how does it work? Just spawning all things in theScene
's world in the main one, and usingParent
/Children
links?And more specific questions about my particular suspected issue:
ShowAabbGizmo
to a mesh within aSceneRoot
?GltfScene
s? This asset contains animations, so I think I must use the Scene and not e.g. the soleGltfPrimitive
converted to aMesh3d
(the fox examples use the full scenes, which is all I have to go off of for idiomacy).Beta Was this translation helpful? Give feedback.
All reactions