Rotate cone with apex as center.

How to rotate cone with apex of cone as center, i have set position as shown in below code,The actual cylinder formation position is at center of circle but i want to set the position of cone at the apex, how can i achieve it

var entity = viewer.entities.add({

position : Cesium.Cartesian3.fromDegrees(longitudeString, latitudeString,height ),

orientation : Cesium.Transforms.headingPitchRollQuaternion(position, hpr),
  
    cylinder : {
        length : distance,
        topRadius : 0.0,
        bottomRadius : 150.0,
       
        outline : true,
         material : Cesium.Color.RED.withAlpha(0.6),

    }
});

Hi! Have you checked out this post that addresses the same concern?

It looks like Matt’s post there shows you how to manually compute this offset in position. Unfortunately there isn’t an easier way in Cesium to do this currently.

I’ve adapted it to show how you can dynamically rotate the cone on its apex using Callback properties in this Sandcastle example.

1 Like

thanks for the reply but i don't want to do like this,i want to change the heading of the cone by keeping apex as origin of rotation.

var heading = Cesium.Math.toRadians(heading_value)

i'm taking heading value dynamically as text input, how can i set the origin of cone as fixed point.

You can write your own helper function that’ll take this heading value and compute the right position offset off from the center. There’s no built-in way to do this at the time of writing.

If you rotate pitch and roll at the same time, how to calculate their offset :grinning: