UNPKG

velox3d

Version:

**velox3d** is a lightweight Three.js scene initializer with built-in best practices, clean defaults, and extensibility. It gives you a powerful 3D setup with just one function call — ideal for beginners and fast prototyping, but flexible enough for advan

17 lines (13 loc) 419 B
import * as THREE from "three"; import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader"; export async function addModel( scene, { src, position = [0, 0, 0], scale = 1 } ) { const loader = new GLTFLoader(); const gltf = await loader.loadAsync(src); gltf.scene.position.set(...position); gltf.scene.scale.set(scale, scale, scale); scene.add(gltf.scene); return gltf.scene; }