three.js改變旋轉中心點方法(附開關門例子)
阿新 • • 發佈:2021-02-06
思路:把需要改變中心點的模型add到一個group,然後修改模型座標。就像前端postion定位一樣
下面寫了一個開關門的例子
let group=new THREE.Group()
let box=new THREE.BoxGeometry(6,6,2)
let mail=new THREE.MeshBasicMaterial({color:0xff6600})
let mesh=new THREE.Mesh(box,mail)
mesh.position. x=3
group.add(mesh)
editor.scene.scene.add(group)
let i=0.05
setInterval(()=>{
group.rotation.y+=i
},200)