I exported an object on Blender.
The exported model file extension is fbx.
and I use FBXLoader to import the file on javascript.
import { FBXLoader } from 'https://unpkg.com/three@0.145.0/examples/jsm/loaders/FBXLoader.js';
const loader = new FBXLoader();
loader.load( 'rect.fbx', function ( object ) {
// center the model
const box = new THREE.Box3().setFromObject( object );
const center = box.getCenter( new THREE.Vector3() );
object.position.x += ( object.position.x - center.x );
object.position.y += ( object.position.y - center.y );
object.position.z += ( object.position.z - center.z );
scene.add( object );
}, undefined, function ( error ) {
console.error( error );
} );
rect.fbx (4.0 KB)