Tile3DLayer error in FirstPersonView
Description
Hi,
I'm experiencing some issues with cesium 3d point clouds. Layer is loaded correctly, but SOMETIMES after few moves I get TypeError: plane.normal.dot is not a function and point cloud disappears from the map.
Important thing is it's happening only in FPV. I've never seen ^^ bug in MapView.
I tried it with multiple different clouds. So it should not be a problem with specific point cloud.
All other layers seems to be working in FPV, so I don't think it's caused by invalid FirstPersonView configuration.
Thanks
Flavors
- [ ] React
- [ ] Python/Jupyter notebook
- [ ] MapboxLayer
- [ ] GoogleMapsOverlay
- [ ] CartoLayer
- [ ] DeckLayer/DeckRenderer for ArcGIS
Expected Behavior
Render cesium 3d point clouds
Steps to Reproduce
Layer
return new Tile3DLayer({
...this.layerCommonProps(layer),
zoomTo: layer.zoomTo,
data: `${this.$configuration.api}/${layer.data}/tileset.json`,
pointSize: layer.pointSize || 1,
loader: Tiles3DLoader,
sizeUnits: 'pixels',
loadOptions: {
'3d-tiles': {
isTileset: true
},
tileset: {
throttleRequests: true
},
fetch: {
headers: this.requestHeaders(),
signal: this.abortSignal
}
},
onTilesetLoad: this.onTilesetLoad3DTiles.bind(this, layer)
})
Move in map (FPV)
Environment
- Framework version: tried multiple versions, same result
- Browser: Chrome
- OS: MacOS, Windows
Logs

Hi, don't you know where could be a problem? Thanks
Per the error, either plane.normal is undefined/null or it is not an instance of math.gl Vector3 class (e.g. it could be just a plain JS array [number, number, number].
Does that enable you to poke around a bit more? Put a breakpoint in getFrameState()?
Hi @ibgreen you're right, sometimes plane.normal is just an Array

but mostly it's Vector

Just adding:
if (plane.normal.dot) {
const distanceToCenter = plane.normal.dot(viewport.center);
scratchPosition.copy(plane.normal).scale(plane.distance - distanceToCenter).add(viewport.center);
}
to https://github.com/visgl/loaders.gl/blob/master/modules/tiles/src/tileset/helpers/frame-state.ts#L140 solves the issue (Point cloud is still visible, otherwise everything disappeared from map)
Don't know if ^^ can potentially break some other stuff.
Thanks!
Yes. It would probably be best to debug why this is happening in the first place. My guess would be that first person view is just copying in some user supplied array whereas other views store it as Vector. It should not be very hard to put breakpoints in the view constructors and figure out what is happening.
deck.gl and math.gl are in the process of (slowly) being converted to typescript. I suspect that one approach to flush this out is to tighten the typings.
This should be fixed by loaders.gl v3.2.6.