deeptwins-engine-3d 0.1.19 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -686,13 +686,21 @@ var ModelRoamRealTime = /*#__PURE__*/function () {
|
|
|
686
686
|
}, {
|
|
687
687
|
key: "updateFirstPersonView",
|
|
688
688
|
value: function updateFirstPersonView(position) {
|
|
689
|
-
|
|
689
|
+
var heading = this.hpRoll.heading;
|
|
690
|
+
var pitch = Cesium.Math.toRadians(this.firstCameraSettings.pitch);
|
|
691
|
+
var roll = 0.0;
|
|
692
|
+
// 根据 heading + pitch 计算前方向向量
|
|
693
|
+
var forward = Cesium.Cartesian3.fromElements(Math.cos(pitch) * Math.sin(heading), Math.cos(pitch) * Math.cos(heading), Math.sin(pitch));
|
|
694
|
+
// 计算偏移方向(distance为正就往反方向移动)
|
|
695
|
+
var offsetDir = Cesium.Cartesian3.multiplyByScalar(forward, -this.firstCameraSettings.distance, new Cesium.Cartesian3());
|
|
696
|
+
// 计算新的相机位置
|
|
697
|
+
var newPosition = Cesium.Cartesian3.add(position, offsetDir, new Cesium.Cartesian3());
|
|
690
698
|
this.getMap().camera.setView({
|
|
691
|
-
destination:
|
|
699
|
+
destination: newPosition,
|
|
692
700
|
orientation: {
|
|
693
|
-
heading:
|
|
694
|
-
pitch:
|
|
695
|
-
roll:
|
|
701
|
+
heading: heading,
|
|
702
|
+
pitch: pitch,
|
|
703
|
+
roll: roll
|
|
696
704
|
}
|
|
697
705
|
});
|
|
698
706
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -50,7 +50,7 @@ loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
|
|
|
50
50
|
export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
|
|
51
51
|
_classCallCheck(this, DeepTwinsEngine3D);
|
|
52
52
|
});
|
|
53
|
-
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.
|
|
53
|
+
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.20");
|
|
54
54
|
_defineProperty(DeepTwinsEngine3D, "Map", Map);
|
|
55
55
|
_defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
|
|
56
56
|
_defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
|