Wings Engine

Adjusting the Origin Latitude and Longitude

The Wings Engine uses a Cartesian coordinate system, whereas CesiumJS uses a geocentric coordinate system. If there is a significant displacement in position, it can cause a mismatch between shadows and the sky. Therefore, we need to set the latitude and longitude of the core region displayed in CesiumJS as the current origin coordinates.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class CesiumDemo {
async init() {
const { Cesium } = this.element.getMountedInstance();
console.debug("Cesium Version:", Cesium.VERSION);

const viewer = new Cesium.Viewer("cesiumContainer");

var entity = viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(116.391935, 39.907123),
point: {
color: Cesium.Color.YELLOW,
pixelSize: 10,
},
});

var heading = 0; // Orientation
var offset = new Cesium.HeadingPitchRange(
Cesium.Math.toRadians(heading),
-Cesium.Math.toRadians(45),
500
);
viewer.zoomTo(entity, offset);
this.viewer = viewer;
this.heading = heading;
this.Cesium = Cesium;
this.entity = entity;
}
update() {
this.heading += 0.03;
let offset = new this.Cesium.HeadingPitchRange(
this.Cesium.Math.toRadians(this.heading),
-this.Cesium.Math.toRadians(15),
500
);
this.viewer.zoomTo(this.entity, offset);
// this.viewer.scene.screenSpaceCameraController.enableInputs = false
}
getCesiumHtml() {
return `
<style>
#cesiumContainer{
width:100%;
height:100%;
margin:0;
padding:0;
overflow:hidden;
}
</style>
<div id="cesiumContainer"></div>
`;
}
}
export default CesiumDemo;

We can see that the coordinates of the current camera orientation are (116.391935, 39.907123). Since this differs from our default origin, mounting this project directly will cause discrepancies in lighting and shadows on the screen. Therefore, we need to change the origin to the coordinates where the camera is oriented.

In the Wings Engine, select the scene component and modify the current origin’s latitude and longitude information to (116.391935, 39.907123, 0), as shown in the image below: