|
|
@@ -145,11 +145,9 @@ export default class Monitor extends THREE.Object3D{
|
|
|
|
|
|
|
|
|
{
|
|
|
-
|
|
|
- let offset = new THREE.Vector3
|
|
|
- if(model.fileType == '3dTiles'){
|
|
|
- offset.fromArray(model.runtime.getTileset().tileset.root.boundingVolume.box.slice(0,3))//必须要平移一段才能重合
|
|
|
- //offset.copy(Potree.math.convertVector.ZupToYup(offset))
|
|
|
+
|
|
|
+ let getVecFromData = (vec)=>{//应该主要是3dtiles要转换
|
|
|
+ return Potree.math.convertVector.YupToZup(vec).applyMatrix4(model.posRot1MatrixInvert)
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -157,13 +155,12 @@ export default class Monitor extends THREE.Object3D{
|
|
|
this.posOffset = new THREE.Vector3(parseFloat(data.data['posOffset-x']), parseFloat(data.data['posOffset-y']), parseFloat(data.data['posOffset-z'])),
|
|
|
|
|
|
// data.position && this.position.copy(data.position)
|
|
|
- this.position.copy(this.posOri).add(this.posOffset).sub(offset)
|
|
|
-
|
|
|
+ this.position.copy(this.posOri).add(this.posOffset)
|
|
|
+ this.position.copy(getVecFromData(this.position))
|
|
|
|
|
|
// target的优先级大于rotation
|
|
|
if (data.target) {
|
|
|
- this.target = data.data.target
|
|
|
- this.target.sub(offset)
|
|
|
+ this.target = getVecFromData(data.data.target)
|
|
|
this.lookAt(data.target)
|
|
|
} else {
|
|
|
data.data.rotation && this.quaternion.setFromEuler(data.data.rotation)
|