About Polyline Dashed

Hello, everyone.

I only look at it every day, but there is an issue, so i heve a question about dashed line.

Express the dot or dashed line on the road.
However, the problem is that is moves alone with the camera movement as blow.
< case shot -1 >
dash_scroll

< case shot -2 >
dash_scroll2

Cesium 1.82 and using normal polyline/Cesium.PolylineDashMaterialProperty.

what i want is not to move.

what would be the solution?

Hi @lion.leekyungseok,

Welcome to the community and thanks for sharing! I really appreciate that you added some screengrabs as well. However, I am a little unclear as to what your intended use case is. Can you elaborate on the behavior that you expect from the dashed polyline?

-Sam

Thank you for your answer.

Ah… I was waiting for the person who knows the answer and implemented it as corridor instead of polyline.

The results are as follows.
< polyline dash > - fallow camra
dash_scroll2

< corridor dash > - static
dash_scroll_corridor2

I don’t know what the performance difference is, but anyway, I’ve reached my goal, so I decided to use it as it is.

Mr. sam.rothstein Thank you again for your reply.

1 Like

Hi @lion.leekyungseok,

Understood :+1:

-Sam

For future reference.
One potential solution is using GridMaterial.

entity.polyline.material = new Cesium.GridMaterialProperty({
            lineCount: new Cesium.Cartesian2(20, 0),
            cellAlpha: 0,
            lineOffset: new Cesium.Cartesian2(0, 0.5),
            lineThickness: new Cesium.Cartesian2(10, 0)
        });

This creates a dashed line that does not move with camera.


When the segments of the line are not the same length, wacky things happen…
image
If your line has roughly same length segments, or it is a single segment, then it should all be good.

This will look similar to ImageMaterialProperty, given a texture of a single dash, but unlike an image of a dash on repeat, the dashes in this case will have no issues with changes in width.

Hope this helps someone.

1 Like

thank to max_izrin very mush for your reply.
your reply is precious anyway.