Quickie: Align rotation / orientation along path: possible?


While doing our Cesium usage refactor in our product’s codebase, we’re trying to clean out many hacks that grew along the way, which may have started to be supported by Cesium natively.

We came up with an apparently simple question: we have a class of entity’s position data pointswhose entity moves a lot but does not provide heading information (nor any other kind of orientation information other than the position).

We’d like to animate the entity on-screen with it’s orientation along the known path (for 3D models) or with the rotation along some axis (for billboards). Can Cesium calculate and render an entity with its orientation / rotation automatically set and interpolated based on a path’s line direction?

If not, would any kind soul provide some insight on the more elegant way to implement this?

Many thanks!


Take a look at this demo: http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Interpolation.html&label=Showcases

You should be able to use the VelocityOrientationProperty to accomplish this.



Many thanks!

(wow, was this a late reply or what)

Is there a way to set VelocityOrientationProperty via CZML?

Thank you so much once again!


Not yet, but apparently it’s on the to do list.

Until then you need to load your czml and then loop through them and manually apply it, something like so:

CZMLentities = dataSource.entities.values;

for (var i = 0; i < CZMLentities.length; i++) {

// Firstly make sure that the vessel can calculate it's own orientation.
CZMLentities[i].orientation = new Cesium.VelocityOrientationProperty(CZMLentities[i].position);



Hope that helps…

Many thanks! I’ll probably do that onLoad with a custom processor.