dengxiaoning / cesium_dev_kit

In my leisure time, I have written some common cases of Cesium (such as model control, analysis, material, shader effect, etc.), and utilized ES6 for packaging with the aim of providing convenience for my friends' studies and work. If this is beneficial to you, please show your support by giving a star.
https://benpaodehenji.com/cesiumDevKit
MIT License
188 stars 58 forks source link

代码没有报错,但是没有显示Cesium地图,平面黑色的,不知道什么原因? #65

Open zenghaiy opened 2 months ago

zenghaiy commented 2 months ago
dengxiaoning commented 2 months ago

是否没有高度? height 修改为 height: 100vh; 试试

zenghaiy commented 2 months ago

我看了three和cesium两个容器的高度都是充满了平面,我还把three的容器设置了透明还是不显示Cesium的地球。

zenghaiy commented 2 months ago

`

` 上面式所有的初始化代码

zenghaiy commented 2 months ago

找到原因了,没有手动调用requestAnimationFrame(),我看例子中也没有调用,以为initCesium中自己做了这些事情呢.

dengxiaoning commented 2 months ago

嗯厉害 :+1: ,找到就好

案例中有写这个的 image

zenghaiy commented 2 months ago

融合好了之后,three.js中添加的模型,能否把模型添加到Cesium中的指定经纬度位置呢?我在文档未找到坐标转换相关的API。

dengxiaoning commented 2 months ago

let center = [104.081701757991, 30.627042558105988]; 就是模型加载的中心位置

zenghaiy commented 2 months ago

Snipaste_2024-07-18_11-47-24 Snipaste_2024-07-18_11-47-36

这上面是Three.js添加实体的代码,但是界面上没有看到这个实体,我把实体的宽高设置很大很小都没有看到这个实体,请大佬看看代码是否有问题?

dengxiaoning commented 2 months ago

mesh位置是否设置有问题,你可以先拷贝我的案例,看能否正确加载

zenghaiy commented 2 months ago

感谢解疑,现在我的模型能够加载进来了,我想修改three.js模型的朝向Z轴朝上,我通过THREE.Object3D.DEFAULT_UP.set(0,0,1)不起作用,方向一点没变。

dengxiaoning commented 2 months ago

试试 mesh.position.set(0, 0, 1);

dengxiaoning commented 2 months ago

也可以 mesh.rotation.x = -Math.PI / 2;