hello,
is it possible to use lod with group of object like this ?
var house_high = new THREE.Group();
house_high.add( lot of mesh | group | object3d coming from glb )
var house_low = new THREE.Group();
house_low.add( lot of mesh | group | object3d coming from glb )
var house_lod = new THREE.LOD();
house_lod.addLevel(house_high,0);
house_lod.addLevel(house_low,50);
scene.add(house_lod) ;
thanks
thank .
so i ve done it , but im not able to switch from low to high when i come near house . i take care about origin of object and i ve checked all origin of object in house_high are inside the house ( the house_low is just a cube with a texture ) . I ve tried too , with 10 instead of 0 for near level , but no change .
and if i change the place ```
house_lod.addLevel(house_high,50);
house_lod.addLevel(house_low,10);
same problem i have the high at start and i cannot switch to house_low . Perhaps i ve missed something about distance ?
EDIt: i use in animate function
console.log("level : " + house_lod.getCurrentLevel () ) ;
so , it start at level 0 , and quickly switch to level 1 even if i dont move , and stay at this level near or far from he house . never come back to level 0 .
my fault …
ive read LOD.js and i ve seen
update( camera ) {
const levels = this.levels;
if ( levels.length > 1 ) {
_v1.setFromMatrixPosition( camera.matrixWorld );
**_v2.setFromMatrixPosition( this.matrixWorld );**
const distance = _v1.distanceTo( _v2 ) / camera.zoom;
levels[ 0 ].object.visible = true;
let i, l;
so i ve understood i have to set house_lod.position with x, y, z of my house .
but because in blender asset are already at x,y,z i have to set house_high.position and house_low.position with -x ,-y,-z
work fine now . thank