Rotation origin

Hi,

I recently watched Eric Haines’ 3D Graphics course on Udacity. (https://www.udacity.com/course/cs291)

He describes how in three.js, the rotation origin is based on the object’s original centre, and as such it’s important to follow the sequence of Scale, Rotate, Translate (as demonstrated in this video: https://youtu.be/CmgSye6-Ack)

In cesiumjs, is it possible to adjust the point around which the rotation occurs?

For example, consider this gist. I’d like to rotate the cone around its apex, not its midpoint. In three.js, this would involve

  1. Translate (move) the cone vertically a distance of height/2. That means the apex is now at the object’s original centre.

  2. Rotate the cone by the desired degrees

In cesium, the rotation point of the cone seems to always follow the entity. Is there are way to adjust the rotation origin?

Thank you,

Fidel

Hi Fidel,

We don’t have direct support for this. However, you can do the equivalent transformation of first translating the cone down such that its apex lies that the origin, then doing the desired rotation.

Hope that helps,

  • Rachel

Thanks Rachel,

I noticed in this gist that the rotation origin is based on certain parts of the model. Is there a way to specify the point of rotation (using a lat/long perhaps) rather than relying on what’s defined in the model?

Thank you,

Fidel

Hi Fidel,

You could write a function that takes a lat/long point, translates the object to be centered at that point, performs the rotation then translates the object back to it’s original position.

Hope that helps,

  • Rachel