CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.85k stars 3.47k forks source link

GLTF models are rotated since 1.47 - how to fix CZML? #6808

Closed sebastienaubry closed 6 years ago

sebastienaubry commented 6 years ago

Hi,

Since release 1.47, the following change has made my aircraft move sideways:

glTF 2.0 models corrected to face +Z forwards per specification. Internally Cesium uses +X as forward, so a new +Z to +X rotation was added for 2.0 models only. To fix models that are oriented incorrectly after this change:

[Fix the glTF model] Apply a -90 degree rotation to the model's heading. This can be done by setting the model's orientation using the Entity API or from within CZML. See #6738 for more details.

I am using a CZML file and the aircraft models from https://github.com/Ysurac/FlightAirMap-3dmodels.

In #6738 I could not find the way to fix my CZML files.

Thanks

hpinkos commented 6 years ago

Hi @sebastienaubry, see this comment: https://github.com/AnalyticalGraphicsInc/cesium/pull/6738#issuecomment-401419826 You can set the orientation property for your model. It would look something like this:

    "position" : {
        "cartographicDegrees" : [longitude, latitude, height]
    },
    "orientation" : {
        "unitQuaternion": [ x, y, z, w ] // compute values using method in #6738
    },
    "model": {
        "gltf" : "..."
    }

If you have any follow up questions, please ask them on our forum: https://groups.google.com/forum/?hl=en#!forum/cesium-dev We use GitHub exclusively for tracking bugs and planning new features. Thanks!

mramato commented 6 years ago

A better solution would be to fix the model itself, but if you can't update the model then @hpinkos' suggestion would be the best way to go.

sebastienaubry commented 6 years ago

Here is the follow-up.