How to apply model orientation rotation then use VelocityOrientationProperty

I am trying to show flights following an arc-ing path from one city to another.

Using the Cesium airplane model provided in the samples, it works perfectly fine using just the VelocityOrientationProperty as orientation alone.

eg.

property = new Cesium.SampledPositionProperty();
property.addSample(startTime, startPosition); property.addSample(midTime, midPosition);
property.addSample(stopTime, stopPosition);

var arcEntity1 = viewer.entities.add({
            position: property,
            orientation: new Cesium.VelocityOrientationProperty(property),
            model: {
     uri: url + "Cesium1.25/Apps/SampleData/models/CesiumAir/Cesium_Air.gltf",
                minimumPixelSize: 128,
                maximumScale: 10000
            },
            path: {
                resolution: 1200,
                material: new Cesium.PolylineGlowMaterialProperty({
                    glowPower: 0.10,
                    color: Cesium.Color.BLUE
                }),
                width: 10,
                leadTime: 0,
                trailTime: 1e10
            }
        });

However, if I use any other airplane models, the model is orthogonal to the flight path as it travels along it.

I was wondering if there's any way to rotate the model first (either in the .gltf file itself or otherwise) so that it uses VelocityOrientationProperty, but is also facing the correct way.

My question is similar to this :

https://groups.google.com/forum/embed/?place=forum/cesium-dev&showsearch=true&showpopout=true&hideforumtitle=true&fragments=true&parenturl=https%3A%2F%2Fcesiumjs.org%2Fforum.html#!searchin/cesium-dev/VelocityOrientationProperty/cesium-dev/ZPGHBaoTco0/NiaJtGscCAAJ

His answer was to use:

entity.orientation = Cesium.Transforms.headingPitchRollQuaternion(currentPos, heading+Math.PI, 0, 0);

but I need use the VelocityOrientationProperty to retain heading, pitch, roll etc as the flight travels on the arc.

Is there any way of using headingPitchRollQuaternion * VelocityOrientationProperty at all?

Thanks!

Hello,

I would recommend re-orienting your model in a model editor and then converting it to glTF. I believe the model needs to be aligned with the X axis.

Best,

Hannah

Thanks for the response!

I figured it'd be a long shot, thanks anyway!

If you want to do the math yourself, you could use a CallbackProperty, and in the callback function, get the rotation for the given time from the VelocityOrientationProperty by calling getValue, then apply your additional rotation and return the result.

I noticed on this group mention that velocityOrientationProperty is planned to be supported in Cesium/.czml. Does anyone know if this has been done?

Hi Paul,

Yes it has, see the docs here: https://cesiumjs.org/Cesium/Build/Documentation/VelocityOrientationProperty.html

Thanks. I’ve seen that documentation but my question is what would I write in the .czml file?

I tried “orientation” : “VelocityOrientationProperty(position)”, where position is my array of lat/lon/alt points, but that didn’t work.

Paul

On Behalf Of Gabby Getz

The examples I’ve seen are all written in JavaScript but my question is how do I do this in a .czml file? Thanks.

Paul

Sorry, I misunderstood. There is currently no way do specify VelocityOrientationPropery for the orientation in the CZML itself. These are the only supported values: https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Orientation. To achieve that result, you’d need to do as Scott mention above in this thread.

Thanks very much, Gabby. Truthfully, I don’t understand how to implement Scott’s approach. My only experience so far is generating the .czml file directly (from
a Matlab script).

On Behalf Of Gabby Getz

The CZML guide is a good place to get started with understanding CZML in general: https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/CZML-Guide, along with the docs on CZML Structure: https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/CZML-Structure

I’m not sure what you are working on, but I think this will be most easily achieved through JavaScript, because it should only be one line similar to:

myObject.orientation = new Cesium.VelocityOrientationProperty(myObject.position);

Thanks again for your assistance, Gabby. I am calling the .czml directly from a browser so I’m not sure how to factor JavaScript into the equation. I agree
with you that it’s probably just a line or two.

The below .czml plots an airplane and its’ path (yellow line) as it travels through the lats/lons/alts in the route and I am trying to get the heading to change
when the plane reaches each waypoint.

[

{

“id” : “document”,

“name” : “August_17,_2017__6:12:22.340_PM”,

“version” : “1.0”

}

I remember seeing it mentioned that .czml support for VelocityOrientationProperty is planned so I was just wondering if that is still the case.

On Behalf Of Gabby Getz

For the CZML support, I opened an issue in the czml-writer repo: https://github.com/AnalyticalGraphicsInc/czml-writer/issues/140 to request the ability to specify orientation with VelocityOrientationProperty. If you have additional information you want to provide, please add it there.

Thanks!

Gabby