|
|
@ -12,7 +12,7 @@ let renderer: THREE.WebGLRenderer |
|
|
|
let controls: OrbitControls |
|
|
|
let mesh: THREE.Mesh |
|
|
|
// 在合适的位置定义组对象 |
|
|
|
const modelGroup = new THREE.Group() |
|
|
|
// const modelGroup = new THREE.Group() |
|
|
|
|
|
|
|
const initThree = () => { |
|
|
|
scene = new THREE.Scene() |
|
|
@ -122,11 +122,13 @@ const initThree = () => { |
|
|
|
const box = new THREE.Box3().setFromObject(mesh) |
|
|
|
const center = box.getCenter(new THREE.Vector3()) |
|
|
|
mesh.position.sub(center) // 将模型中心移到原点 |
|
|
|
// mesh.scale.set(0.5, 0.5, 0.5) |
|
|
|
mesh.scale.set(0.5, 0.5, 0.5) |
|
|
|
mesh.rotateX(Math.PI / 2) |
|
|
|
// mesh.position.set(-100, 0, 0) |
|
|
|
scene.add(mesh) |
|
|
|
modelGroup.add(mesh) |
|
|
|
// modelGroup.add(mesh) |
|
|
|
}) |
|
|
|
modelGroup.position.set(0, 0, 0) |
|
|
|
// modelGroup.position.set(0, 0, 0) |
|
|
|
|
|
|
|
// AxesHelper:辅助观察的坐标系 |
|
|
|
const axesHelper = new THREE.AxesHelper(100) |
|
|
|