deeptwins-engine-3d 0.1.20 → 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.
|
@@ -689,14 +689,20 @@ var ModelRoamRealTime = /*#__PURE__*/function () {
|
|
|
689
689
|
var heading = this.hpRoll.heading;
|
|
690
690
|
var pitch = Cesium.Math.toRadians(this.firstCameraSettings.pitch);
|
|
691
691
|
var roll = 0.0;
|
|
692
|
-
// 根据 heading
|
|
693
|
-
var
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
//
|
|
697
|
-
var
|
|
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());
|
|
698
704
|
this.getMap().camera.setView({
|
|
699
|
-
destination:
|
|
705
|
+
destination: cameraPosition,
|
|
700
706
|
orientation: {
|
|
701
707
|
heading: heading,
|
|
702
708
|
pitch: pitch,
|
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);
|