Open lmd3coder opened 6 years ago
Got it working in my application. I use this loader, make sure to load the script before loading your app: https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/GLTFLoader.js
Implementation should work like this:
const tb = new Threebox(map, mbxContext);
const position = { lat: 52.00, lng: 7.2 };
const loader = new THREE.GLTFLoader();
console.log(loader); // Check your browser console to see if this function is available.
loader.load(`./objects/test/test.gltf`, (gltf) => {
const mesh = tb.Object3D({obj: gltf.scene, units:'meters' }).setCoords([position.lng, position.lat]);
tb.add(this.mesh);
});
Got it working in my application. I use this loader, make sure to load the script before loading your app: https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/GLTFLoader.js Implementation should work like this:
const tb = new Threebox(map, mbxContext); const position = { lat: 52.00, lng: 7.2 }; const loader = new THREE.GLTFLoader(); console.log(loader); // Check your browser console to see if this function is available. loader.load(`./objects/test/test.gltf`, (gltf) => { const mesh = tb.Object3D({obj: gltf.scene, units:'meters' }).setCoords([position.lng, position.lat]); tb.add(this.mesh); });
Hello,how can i set scale and rotation?I used obj.set(options) ,but this can't work.
Got it working in my application. I use this loader, make sure to load the script before loading your app: https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/GLTFLoader.js Implementation should work like this:
const tb = new Threebox(map, mbxContext); const position = { lat: 52.00, lng: 7.2 }; const loader = new THREE.GLTFLoader(); console.log(loader); // Check your browser console to see if this function is available. loader.load(`./objects/test/test.gltf`, (gltf) => { const mesh = tb.Object3D({obj: gltf.scene, units:'meters' }).setCoords([position.lng, position.lat]); tb.add(this.mesh); });
Hello,how can i set scale and rotation?I used obj.set(options) ,but this can't work. Use scale and rotation modification on gltf.scene object not Object3d:
gltf.scene.scale.set(1, 1, 1); gltf.scene.rotation.x = Math.PI / 2;
Is threebox compatible with GTLF loader. I cannot seem to get it to work.