How to make the cylinder rotate around a point

Hello community!
I try to rotate the object in the following way, but it doesn’t seem normal. How can I normally rotate the object around a certain point.

const viewer = new Cesium.Viewer("cesiumContainer");
const center = new Cesium.Cartesian3.fromDegrees(117, 39, 30000);
const point = viewer.entities.add({
  position:center,
  point:{
    pixelSize:5,
    color:Cesium.Color.RED
  }
});
const cylinder = viewer.entities.add({
  position:new Cesium.Cartesian3.fromDegrees(117, 39, 22500),
  orientation:Cesium.Transforms.headingPitchRollQuaternion(center, new Cesium.HeadingPitchRoll(0, Cesium.Math.PI_OVER_TWO, 0)),
  cylinder:{
    length:15000,
    topRadius:0.0,
    bottomRadius:7500,
    material: Cesium.Color.RED.withAlpha(0.5)
  }
});
viewer.flyTo(cylinder);

demo

Hi @zhanglin ,

You can use CallbackProperty to keep changing heading. Check this modified example.

  • Regards

Thank you for your reply, ha ha! I may not express my idea. My idea is that the cone rotates around the top of the cone,By default, a cone rotates around its center
like this
image

In that case you need to change the center point position to cone’s top ( that should be half of the length of the cone).

In this way, the top of the cone can be placed at this point, but the top of the cone will not be at this point after rotation. My idea is that no matter how the cone rotates and the top does not change its position, how should this be realized?

You can check this similar post. I hope it will help you.

1 Like

This is really a great link. If you rotate pitch and roll at the same time, how to calculate their offset.

const Heading = 0;
const Pitch = 60;
const Roll = 60;

const orientation = Cesium.Transforms.headingPitchRollQuaternion(center, new Cesium.HeadingPitchRoll(0, Pitch , Roll))