polygon: { hierarchy: m_poss, material: pcolor.withAlpha(0.2), }, 绘制贴地面区域
鼠标在区域外点击模型,也能识别到贴地面对象,
而且识别的面对象有的不是附近的面。
cesium sdk v11.1, v11.2 ,v11.3, 都有这个拾取问题,
scene.globe.depthTestAgainstTerrain = true; 设置true 也不行
您好!
我本地使用 Cesium.SuperMapVersion 为 43549 的包并未重现您所描述的拾取不准的情况。方便的话您可以将您加载entity的完整代码发出,我这再尝试复现。
此外,对于您这种需要拾取到一类entity的情况,建议可以使用id进行区别,实现可以参考如下代码:
const pickHandler = new Cesium.ScreenSpaceEventHandler(window.viewer.scene.canvas) pickHandler.setInputAction((event) => { const feature = window.viewer.scene.pick(event.position) if (Cesium.defined(feature)) { if (Object.prototype.hasOwnProperty.call(feature, 'id') && feature.id instanceof Cesium.Entity) { if (feature.id._id.startsWith('identify-area')) { const entity = viewer.entities.getById(feature.id._id) tableData.value = Object.keys(entity.info).map((key) => { return { name: key, info: entity.info[key] } }) showInfo.value = true } } } }, Cesium.ScreenSpaceEventType.LEFT_CLICK)
希望可以帮助到您!
代码是设置entity贴在S3M图层上的吗,可以设置entity的polygon的
classificationType: Cesium.ClassificationType.S3M_TILE
贴在S3M 模型表面