|
@@ -54115,13 +54115,9 @@
|
|
|
|
|
|
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);
|
|
|
- }
|
|
|
-
|
|
|
+ endPitch = info.endPitch;
|
|
|
+ let a = math.getStandardYaw(this.yaw, info.endYaw );
|
|
|
+ startYaw = a[0]; endYaw = a[1];
|
|
|
}else if(info.target ){
|
|
|
endTarget = new Vector3().copy(info.target);
|
|
|
endQuaternion = math.getQuaFromPosAim(endPosition,endTarget); //若为垂直,会自动偏向x负的方向
|
|
@@ -54974,7 +54970,16 @@
|
|
|
linearClamp(value, x1,x2, y1, y2){//x为bound.min, bound.max
|
|
|
value = MathUtils$1.clamp(value, x1,x2);
|
|
|
return y1 + ( y2 - y1) * (value - x1) / (x2 - x1)
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ getStandardYaw(yaw1, yaw2) {
|
|
|
+ //使yaw1过渡到yaw2时朝角度差小的那边走。如果差距大于半个圆,就要反个方向转(把大的那个数字减去360度)
|
|
|
+ if (Math.abs(yaw1 - yaw2) > Math.PI) {
|
|
|
+ yaw1 > yaw2 ? (yaw1 -= Math.PI * 2) : (yaw2 -= Math.PI * 2);
|
|
|
+ }
|
|
|
+ return [yaw1, yaw2]
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
|