Open
Description
After loading gltf, the model keeps displaying vertically. Adjusting rotateZ, rotateY, and rotateX does not take effect. How can I quickly make the model display horizontally on the ground and adjust the horizontal angle
Your Environment
- Version used:2.44.2
- Browser Name and version:
code
`const loader = new GLTFLoader3D()
const dracoloder = new DRACOLoader()
dracoloder.setDecoderPath('/draco/')
loader.setDRACOLoader(dracoloder)
// 开始加载
loader.load('/model5.glb', (gltf) => {
const model = gltf.scene
// building coordinate
const coord = new itowns.Coordinates(
'EPSG:4326',
113.249257,
28.408089,
0
)
console.log(coord.as(view.referenceCrs))
model.position.copy(coord.as(view.referenceCrs))
// *********************************************************
// align up vector with geodesic normal
model.lookAt(model.position.clone().add(coord.geodesicNormal))
model.rotateZ(-Math.PI / 2)
// *********************************************************
model.scale.set(100, 100, 100)
// update coordinate of the mesh
model.updateMatrixWorld()
view.scene.add(model)
view.notifyChange()
})
`
Activity