Model rotating with earth with czml positions

We have a model that we are feeding position data to and processing. This model is going into space.
We have noticed the model is rotating with the earth when given position data that is processed. Also when we show the czml path line it rotates around it. Is there something we can do to make sure the model stays at a fixed orientation?
Also is there a way to possibly make the model’s orientation relative to the sun? So the bottom of the model would be always pointing at the sun unless given some orientation data.

Can you provide us with a Sandcastle example of your model with the rotating earth? You can visit this thread to learn more about sharing a custom Sandcastle.

It will be very helpful for us to visualize your issues and be able to make adjustments to the code so you can have a working example.

Also it doesn’t seem to be happening until I add an orientation to the model.
To solve the first issue I need to apply an orientation based off of the default orientation before anything is applied.
To solve the second issue I need to have the default orientation be to the sun not the earth.

link.zip (503.6 KB)

attached link in zip file for sandcastle when I copied to long for posting

To see what I mean after czml is loaded span the timeline to see the model rotating. Comment out the orientation line to se no spinning.

For some reason I am not able to see the code and the demo when I opened the link in link.zip. Can you try adding the link to your comment with the hyperlink feature?

For making the model’s orientation align to the sun, there is no easy way to do this as we don’t store the Sun’s orientation data. You’ll have to do some experimenting to see what the the sun’s direction is relative to a certain location on earth, and make that a reference point to use for the orientation of other billboards when the earth is rotating.

Hello World.zip (449.3 KB)

I tried that and I still got an error that my message body is too large.
Here is a saved zip of the html I saved from the hello world. just take the javascript part and copy paste in a sandcatle

Thank you for sharing the code. Instead of manually setting the orientation after loading the entity, you can add this property to the JSON representation at the same level as id or name:

"orientation" : {
      "velocityReference": "#position"
},

This will set the orientation of the model based on its position. I tried this with your data and it worked (the plane’s orientation follows the line) until a certain point when it starts to spin. This might be caused by some strange position data, or some unintended orientation data that you might have passed in in the json.

Okay but I want the orientation to not be based off of position/velocity. I want it to be based off of quaternions I pass it.

If I supply a quaternion of a 90 degree rotation on the x axis I want it the pitch to change by 90 and not spin with the earth.

It looks like it doesn’t spin when you set the orientation to be Quaternion.IDENTITY until the path became almost vertical (which was the same point where the plane started spinning with the velocityReference set to #position). Did you have orientation data in the json string that maybe changing the plane’s orientation alongside the Quaternion.IDENTITY value?

This post might also help explain the orientation attribute and how it sets the plane’s axes.

There is no orientation data supplied until we supply the quaternion identity.

I also noticed that it sets an entity in czmldata source when processed vs a primitive and every heading pitch roll example you have sets the model as a primitive. could this be the issue?

That could also be the case. CZML sets the orientation such that it takes the the axes of the object and transforms it to the Earth’s fixed axes (check out the link in my last reply for more information on this). I suspect that when the path changes orientation to being almost vertical to the earth, the plane tries to reorient to properly correlate to the Earth’s axis and then takes on the orientation that you passed in.

Is there a way to bypass transforming to Earth’s fixed axis?

I don’t believe there is, not with CZML.