How can i read GLTF asset vertices and triangles data

(Patryk Budzyński) #1

Hi! I’m porting my navmesh navigation crate into Amethyst and one of request was to be able to build navmesh objects from GLTF - is there an example of how i can get list of vertices and triangles from that object?

2 Likes
(Théo Degioanni) #2

Grab the AssetStorage for GltfPrefab to get a reference to the prefab data (the big “plan” the gltf describes) using your handle. Inside of it you will find a mesh field containing a mesh handle that you can use with the AssetStorage for Mesh. This should give you direct (immutable) access to the mesh data. If you need more details on one of those steps feel free to ask!

3 Likes
(Joël Lupien) #3

Only issue with that is that you can’t actually read the mesh data from Mesh… https://docs.amethyst.rs/master/amethyst_rendy/rendy/mesh/struct.Mesh.html

We used to have the GltfPrefab add the MeshData struct as a component on the entity being created, but this was removed by the renderer changes and never replaced with something else :confused:

1 Like
(Théo Degioanni) #4

Yeah that’s right, it’s probably a missing feature in the new renderer. Maybe we should open an issue?

(Patryk Budzyński) #5

i think we should - otherwise i’ll have to crease dedicated asset which is not the best solution to this problem ;o