fbxResource
Creates a resource for loading FBX 3D models. Supports loading single files, arrays of files, or record objects mapping keys to URLs.
import { fbxResource } from 'angular-three-soba/loaders';
@Component({...})class MyComponent { // Single file fbx = fbxResource(() => '/models/character.fbx');}Loading multiple files
Section titled “Loading multiple files”@Component({...})class MyComponent { // Array of files fbxs = fbxResource(() => ['/models/a.fbx', '/models/b.fbx']);}Loading named files
Section titled “Loading named files”@Component({...})class MyComponent { // Named files as record models = fbxResource(() => ({ hero: '/models/hero.fbx', enemy: '/models/enemy.fbx', }));
constructor() { effect(() => { const models = this.models.value(); if (models) { console.log(models.hero); // Group console.log(models.enemy); // Group } }); }}Using in template
Section titled “Using in template”@Component({ template: ` @if (fbx.value(); as fbx) { <ngt-primitive *args="[fbx]" /> } `, imports: [NgtArgs], schemas: [CUSTOM_ELEMENTS_SCHEMA],})class MyComponent { fbx = fbxResource(() => '/models/character.fbx');}Static Methods
Section titled “Static Methods”fbxResource.preload(input)- Preloads FBX models into the cache.
// Preload a single modelfbxResource.preload('/models/character.fbx');
// Preload multiple modelsfbxResource.preload(['/models/a.fbx', '/models/b.fbx']);
// Preload named modelsfbxResource.preload({ hero: '/models/hero.fbx', enemy: '/models/enemy.fbx',});