deeptwins-engine-3d 0.1.19 → 0.1.21
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,27 @@ 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/roll 计算旋转矩阵
|
|
693
|
+
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
|
|
694
|
+
var orientationMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(position, hpr, Cesium.Ellipsoid.WGS84, Cesium.Transforms.localFrameToFixedFrameGenerator('east', 'north'));
|
|
695
|
+
|
|
696
|
+
// 获取局部 forward(朝前)方向
|
|
697
|
+
var forwardLocal = new Cesium.Cartesian3(0, 1, 0); // 注意:在Cesium中,局部Y是朝前
|
|
698
|
+
var rotation = Cesium.Matrix4.getMatrix3(orientationMatrix, new Cesium.Matrix3());
|
|
699
|
+
var forwardWorld = Cesium.Matrix3.multiplyByVector(rotation, forwardLocal, new Cesium.Cartesian3());
|
|
700
|
+
|
|
701
|
+
// 计算偏移(distance正往后)
|
|
702
|
+
var offset = Cesium.Cartesian3.multiplyByScalar(forwardWorld, -this.firstCameraSettings.distance, new Cesium.Cartesian3());
|
|
703
|
+
var cameraPosition = Cesium.Cartesian3.add(position, offset, new Cesium.Cartesian3());
|
|
690
704
|
this.getMap().camera.setView({
|
|
691
|
-
destination:
|
|
705
|
+
destination: cameraPosition,
|
|
692
706
|
orientation: {
|
|
693
|
-
heading:
|
|
694
|
-
pitch:
|
|
695
|
-
roll:
|
|
707
|
+
heading: heading,
|
|
708
|
+
pitch: pitch,
|
|
709
|
+
roll: roll
|
|
696
710
|
}
|
|
697
711
|
});
|
|
698
712
|
}
|
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.21");
|
|
54
54
|
_defineProperty(DeepTwinsEngine3D, "Map", Map);
|
|
55
55
|
_defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
|
|
56
56
|
_defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
|