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
2 ways to do it:
https://playground.babylonjs.com/#10D6YT#398
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.
Thank you @bghgary ! Have a great weekend.
For some reasons the PG example doesn’t work with the latest Babylon version.
This is because we removed the return value from the Append
function (see Potential new breaking change - Please chime in! - Breaking Changes - Babylon.js). You can fix it by doing this: https://playground.babylonjs.com/#10D6YT#1151
@Deltakosh FYI