|
@@ -217,15 +217,21 @@ class ExtendView extends View {
|
|
let endPosition = new THREE.Vector3().copy(info.position)
|
|
let endPosition = new THREE.Vector3().copy(info.position)
|
|
let startPosition = this.position.clone();
|
|
let startPosition = this.position.clone();
|
|
let startQuaternion, endQuaternion, endTarget = null,
|
|
let startQuaternion, endQuaternion, endTarget = null,
|
|
- endYaw = info.endYaw, startYaw, endPitch = info.endPitch, startPitch ;
|
|
|
|
|
|
+ endYaw, startYaw, endPitch, startPitch ;
|
|
|
|
|
|
|
|
|
|
this.restrictPos(endPosition)
|
|
this.restrictPos(endPosition)
|
|
|
|
|
|
|
|
|
|
- if(endYaw != void 0) {
|
|
|
|
- startYaw = this.yaw
|
|
|
|
- startPitch = this.pitch
|
|
|
|
|
|
+ if(info.endYaw != void 0) {
|
|
|
|
+ startPitch = this.pitch
|
|
|
|
+ endPitch = info.endPitch;
|
|
|
|
+ startYaw = this.yaw
|
|
|
|
+ endYaw = info.endYaw
|
|
|
|
+ if(Math.abs(startYaw - endYaw)>Math.PI){//如果差距大于半个圆,就要反个方向转(把大的那个数字减去360度)
|
|
|
|
+ startYaw > endYaw ? (startYaw -= Math.PI*2) : (endYaw -= Math.PI*2)
|
|
|
|
+ }
|
|
|
|
+
|
|
}else if(info.target ){
|
|
}else if(info.target ){
|
|
endTarget = new THREE.Vector3().copy(info.target)
|
|
endTarget = new THREE.Vector3().copy(info.target)
|
|
endQuaternion = math.getQuaFromPosAim(endPosition,endTarget) //若为垂直,会自动偏向x负的方向
|
|
endQuaternion = math.getQuaFromPosAim(endPosition,endTarget) //若为垂直,会自动偏向x负的方向
|