here the only difference i see in the y axis is there any way to bring the group at same level. I mean at same y level. Please i am glad if some one give me a quick help
If group1.position.y = group2.position.y doesn’t do it for you, I assume you have several objects in the group that have various y-axis positions?
In this case, it should be enough if you calculate the difference on the y-axis between the groups (probably best to use bbox.min.y, it will then place them on the same elevation like you’d be placing them on a floor):
// Calculate half-distance between the groups on y-axis (bounding box of group1 - bounding box of group2)
const dy = (groupBox2.min.y - groupBox1.min.y) / 2;
// Move each group halfway towards the other (group1+, group1-)
group1.position.y += dy;
group2.position.y -= dy;
Thank you so much for putting efforts i agree with most of your statement and i am learning three js so i am glad i thought in the same way as you did.
I am using this library so it is giving me terrain and i am converting the terrain in flat terrain by setting the z position in its geometry to 0.
Here the problem is terrain never comes at the actual seen position 0,0,0 so i translate y of each child to -box.max.y to bring the terrain near to scene center but it is little underneath the center
I want for any lat lon the flat and terrain comes at the scene center 0,0,0
Pardon? I don’t really understand what you mean or what the problem is. Can you share a jsfiddle showing what’s the issue, and explain what you tried until this point?
That’s probably a bad idea, if meshes are in groups, translate groups - not each child separately.
const box = new THREE.Box3().setFromObject( terrain );
terrain.translateY(-box.max.y)
here terrain is a group and i think this code translate each child in the group also
I mean whatever location i choose the flat site and terrain site both should come at same place means at center of the scene like overlapping each other
flat-site is at origin (0,0,0) but terrain is not.