Using GroundPolylinePrimitive for animation

Hey all. I’d like to get (many) thousands of lines animating smoothly on the globe, and it seems like GroundPolylinePrimitive is my best option.

I have a trivial bit of code that uses a custom render loop to draw everything we need, and just to get started with GroundPolylinePrimitive I’m adding one to viewer.scene.groundPrimitives every frame, then deleting it and creating a new (slightly different) one.

If I zoom into the the lat/long where I know I placed the line I can occasionally see it, but not often; it flickers like crazy and it’s non-visible more often than it is visible.

Does anyone have an example of smoothly animating a GroundPolylinePrimitive?

Thank you!

I figured this out over the weekend after poring over the documentation. I finally discovered this line:

“Determines if the geometry instances will be created and batched on a web worker.”

(Found in the GroundPolylinePrimitive asynchronous flag description here.

In short, since I’m killing / recreating these things N times a second during my customRenderLoop, the async terrain height calculation never had a chance to happen. By calling initializeTerrainHeights() once at startup time and setting asynchronous to false, I got the ground polyline to render just fine.

Maybe this will help someone else in the future.