本地的3dtiles模型采用ContextCapture 19生成. 利用Cesium实验室V3.08对OSGB格式转换到3dtiles,得到的结果加载时老是报
TypeError: Cannot read properties of undefined (reading 'updateTransform')错误。
没搞明白为啥,不过3dtiles文件夹层级目录的命名应该从以前到现在发生了不少改变。
目前CC19生成的目录如下:
发布后加载,有时候始终出不来,用CesiumLab三维可视功能加载一下,突然又好了,挺诡异的,还得再测试一下。
源码:
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <!-- Use correct character set. --> 5 <meta charset="utf-8" /> 6 <!-- Tell IE to use the latest, best version. --> 7 <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 8 <!-- Make the application on mobile take up the full browser screen and disable user scaling. --> 9 <meta 10 name="viewport" 11 content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" 12 /> 13 <title>Hello World!</title> 14 <script src="../Build/CesiumUnminified/Cesium.js"></script> 15 <style> 16 @import url(../Build/CesiumUnminified/Widgets/widgets.css); 17 html, 18 body, 19 #cesiumContainer { 20 width: 100%; 21 height: 100%; 22 margin: 0; 23 padding: 0; 24 overflow: hidden; 25 } 26 </style> 27 </head> 28 <body> 29 <div id="cesiumContainer"></div> 30 <script> 31 Cesium.Ion.defaultAccessToken='你的Token'; 32 var viewer = new Cesium.Viewer('cesiumContainer', { 33 timeline:false, 34 animation:false, 35 vrButton:true, 36 sceneModePicker:false, 37 infoBox:true, 38 scene3DOnly:true, 39 terrainProvider: Cesium.createWorldTerrain() 40 }); 41 viewer._cesiumWidget._creditContainer.style.display = "none"; 42 var tileset = new Cesium.Cesium3DTileset({ 43 url: "../Scene/tileset.json", 44 maximumScreenSpaceError : 1}); 45 <!-- const tileset = await Cesium.Cesium3DTileset.fromIonAssetId(40866);--> 46 viewer.scene.primitives.add(tileset); 47 viewer.zoomTo(tileset); 48 viewer.homeButton.viewModel.command.beforeExecute.addEventListener(function(commandInfo) { 49 // Fly to tileset 50 viewer.flyTo(tileset); 51 52 // Tell the home button not to do anything 53 commandInfo.cancel = true; 54 }); 55 </script> 56 </body> 57 </html>
效果:
标签:tileset,viewer,笔记,3dtiles,Cesium,true,加载 From: https://www.cnblogs.com/yhlx125/p/17536655.html