GLL.prototype.PosAndRotY = G__.prototype.PosAndRotY = function (x, y, z, degree){
this.pos(0,0,0)
var groupTmp = new THREE.Group();
addAllTo3jGroup(this ,groupTmp);
groupTmp.position.set(x, y, z);
groupTmp.rotateY(degree);
groupTmp.updateMatrixWorld();
setPosFrom3jGroup(this);
}
function addAllTo3jGroup (myGroup , threeGroup){
myGroup.objs.forEach(item => {
if (item.objs)
addAllTo3jGroup(item, threeGroup)
else if (item.isObject3D)
threeGroup.add(item)
})
}
function setPosFrom3jGroup(myGroup){
myGroup.objs.forEach(item => {
if (item.objs)
setPosFrom3jGroup(item)
else if (item.isObject3D){
item.matrixWorld.decompose( item.position, item.quaternion, item.scale );
scene.add(item)
}
})
}
网友评论