#Documentation for loading glb primitives

16 messages · Page 1 of 1 (latest)

woeful abyss
#

Is there any documentation around asset_server in particular loading glb files?
In particular I'm struggling with loading colliders for this house, there's a few different shapes in the blender scene - in particular the original cube I started with is not exported which I assume is why I get a panic on line 2.

For more specifics; attached is a screenshot, I want the boarding to be 'collidable', but I'm not sure without just trial and error what the mesh/primitive values should be.

let house_prim = asset_server.load("models/house.glb#Mesh0/Primitive0");
let house_mesh = meshes.get(&house_prim).unwrap();
let collider = Collider::from_bevy_mesh(house_mesh, &ComputedColliderShape::TriMesh)
        .unwrap_or(Collider::default());
fair fox
woeful abyss
#

It is possible to name object in glb scenes in blender using the Outliner dock (the tree view at the top right) and double-clicking object names.
This is interesting in the linked scene hook repo. I guess this is more of a blender question, but the concept of primitives seems a little different there. Is that quote suggesting I can change Cube.005 to awesomename and import it like asset_server.load("models/house.glb#boarding/awesomename")?

fair fox
#

I don't think so, have you tried? I think it might be possible (not sure) to do asset_server.load("models/house.glb#awesomename") though

woeful abyss
#

Just tried now, neither asset_server.load("models/house.glb#awesomename") nor asset_server.load("models/house.glb#Boarding/awesomename") worked 😦

fair fox
#

hmm it might be a different syntax

woeful abyss
fair fox
#

Seems like you can use the index of the mesh in the scene?

woeful abyss
#

Trouble is I don't remember which order I spawned them in in blender. Can't seem to find it either. See how their bishop is mesh6, but appears first in blender as it sorts alphabetically 🤔

livid shell
woeful abyss
#

I was just rereading that page now. Going to go super slow and hopefully find my mistake

#

I suspect some combination of what I tried would have worked, however the glb file just won't have loaded in time for the unwrap()

livid shell
#

yep it will prob need to be in another system that can check each frame to see if it's loaded

#

I put a Vec in a resource and would keep the "loading" ones there so I knew what to check for, and remove them once they'd loaded

woeful abyss
#

Oooh, that's smart

stiff moss
#

.glb#Mesh0/Primitive0 works for me if I have a single object in my Blender scene. I'm making sure it's loaded with bevy_asset_loader