peterqliu / threebox

A three.js plugin for Mapbox GL JS, with support for basic animation and advanced 3D rendering.
MIT License
526 stars 320 forks source link

use threebox to add glb models to mapbox with some problem #52

Open vscchencc opened 5 years ago

vscchencc commented 5 years ago

I have used threebox to add custom models

const loader = new GLTFLoader();

loader.load('/assets/test.glb',function(obj){
      obj.scene.rotation.x = 90 * Math.PI / 180;
     obj.scene.scale.set(50,50,50);

      threebox.addAtCoordinate(obj.scene,[112.5609,37.85418]);
})

In chrome . the models has added successful. But the console appeared a warning

THREE.Matrix3: getInverse() can't invert matrix , determinant is 0

if i drag the map , the console has appeared a lot of warnings.

the second question

const data = [
    [112.5609,37.85418],
    [112.5109,37.85418],
    [112.5309,37.85418],
]
for(let i = 0; i < data.length; i++) {
    threebox.addAtCoordinate(obj.scene,data[i]);
}

I use the above code,It only shows one model on the map.

const data = [
    [112.5609,37.85418],
    [112.5109,37.85418],
    [112.5309,37.85418],
]
for(let i = 0; i < data.length; i++) {
    threebox.addAtCoordinate(obj.scene.clone(),data[i]);
}

It has worked, But It also appears a lot of warnings.

thx.