How to Access extras Property of Loaded GLTF

According to the GLTF specification, the extras property is for storing application specific data. How do we access the extra property of a loaded GLTF in BJS?

Adding @bghgary


Thanks @sebavan ! I really would like some clarity in this regard to find its way into the BJS documentation. @bghgary

1 Like

2 ways to do it:

or you can directly access extras of meshes and so on via mesh.metadata.gltf.extras for instance

Thanks @sebavan . I will check this out. To be clear, I am only referring to the top level extras attribute, as defined in the GLTF specification, not the extras attribute on a single mesh.

There are only a few extras being loaded right now by default with the ExtrasAsMetadata loader extension. Nodes, cameras, and materials.

Seb’s solution works. You can also create a custom loader extension to customize it to your liking or contribute more code to the ExtrasAsMetadata loader extension.

Getting this info into the documentation would be great! Please contribute if you can. :slight_smile:


Thank you @bghgary ! Have a great weekend.