Loading GLB models
Add a ready-made 3D object to a Three scene.
Place tree.glb in game/assets/models/. GLB stores a 3D object and its resources in one file. The SDK loader accepts static GLB 2.0 without animation, skinning, external files or required extensions.
Pass a models field to AssetManifestBuilder with file URLs collected by import.meta.glob<string>('@game/assets/models/**/*.glb', { eager: true, query: '?url', import: 'default' }). The default policy creates the models bundle.
Add 'models' to SceneConfig.assets.bundles, then add a tree to the Group node’s children:
"tree": {
"type": "Model",
"props": {
"asset": "models/tree.glb",
"position": { "x": 2, "y": 0, "z": 0 }
}
}
Model nodes share the file’s resources, so those resources must not be destroyed manually for one tree. A node releases its instance when removed. Then assets.unload('models/tree.glb') can remove the asset from the cache.
For a custom Three scene inside a Pixi texture, retrieve the ModelAsset, call acquire() and add its view to the scene. The component removes the object from the scene and calls release() during cleanup. Live instances prevent eviction of the shared asset.