Cesium开发--控制视角可以在地下移动_初生的太阳丶的博客
作者:互联网
html代码
<head>
<meta charset="utf-8">
<!-- Include the CesiumJS JavaScript and CSS files -->
<script src="https://cesium.com/downloads/cesiumjs/releases/1.79.1/Build/Cesium/Cesium.js"></script>
<link href="https://cesium.com/downloads/cesiumjs/releases/1.79.1/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
</head>
<body>
<!-- 用来做Viewer的容器 -->
<div id="cesiumContainer"></div>
</body>
js代码
//申请密匙
Cesium.Ion.defaultAccessToken ='你的TOKEN';
//设置随机数种子
Cesium.Math.setRandomNumberSeed(1234);
//声明一个Viewer (Viewer是一个带有多种功能的可交互的三位数字地球的容器(盒子))
var viewer = new Cesium.Viewer('cesiumContainer');
//声明场景
var scene = viewer.scene;
//相机允许在地底移动
scene.screenSpaceCameraController.enableCollisionDetection = false;
/*
声明primitives对象
primitives由两个部分组成:1.几何图形(Geometry):定义了Primitive的结构,例如:三角形、线条、点等
2.外观(Appearance ):定义Primitive的着色( Sharding),包括GLSL(OpenGL着色语言,OpenGL ShadingLanguage)
顶点着色器和片段着色器(vertex and fragment shaders),以及渲染状态(render state)
*/
var primitives = scene.primitives;
//定位视角
viewer.camera.flyTo({ //定位到范围中心点
destination: {
x: -2235586.6315060216,
y: 5256284.124910769,
z: 2828356.9505067402
},
//destination: rectangle,
orientation: {
heading: 5.984385181724655, //1
pitch: -0.07564218489559749,
roll: 0.0
},
})
本文转自 https://blog.csdn.net/Strive279/article/details/116480854,如有侵权,请联系删除。
标签:--,初生,scene,var,primitives,viewer,Viewer,Cesium 来源: https://www.cnblogs.com/hustshu/p/16193691.html