Polyline scaleByDistance Equivilent?


I have a situation where I am using a polyline in an entity as a velocity leader. The entity is represented by a point. I aim to use the scaleByDistance functionality across BOTH the point and polyline. I was wondering if there’s a straightforward method of applying the same kind of scaling for the polyline?


Polylines and most other geometry are defined in three-dimensional space, so they automatically scale by distance based on their real-world size. There’s no way to way to easily modify this behavior for a polyline.

Since you’re using a leader, are you trying to make the sure line is still visible when you are far away? If that’s your goal then you should be able to do what you want with a simple arrow/line Model which do support specifying a minimum size in pixels, so it will shrink as you get farther away but only until it hits a minimum size that you specify. You can see this in the 3D models demo by zooming out: http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=3D%20Models.html&label=Showcases

If that’s not what you had in mind, can you provide some more details?

Yes that was the initial intention. However, now I require the line to eventually disappear at a far distance, but for it to grow while zooming in on the point. Eventually that line length will reach a maximum length. Again this is similar to a scaleByDistance setup.

That makes sense for scaling. However the leader needs to also adjust length based on velocity and orient with a heading. Although I’m sure that’s possible with a model, I just wonder if it would be more difficult than using a polyline where currently I just update the end point vector. The graphics does the rest.

Alternatively I have been able to adjust the visibility of the line via multiplying with a constant. However that doesn’t provide scaling limits. I was thinking perhaps using a check against the camera magnitude and adjusting the constant accordingly.