Is it possiable to make entity position as the vertex of circular cone(cylinder)

Currently, the entity position is the center of circular cone(cylinder). In my project, I
need to make the entity position as the vertex of it. Is it possible ? If yes, could you give me some guide .

I guess I need to modify the code in CylinderGeometry.createGeometry.

Many Thanks!

Hello,

In order to achieve this, you will need to have one entity define and position the cone, and one entity to define the point with a position at (longitude, latitude, coneHeight).

Let me know if you need an example.

Best,

Hannah

Thanks for your help. But I think it is a bit difficult to compute the position of the cone.
An example will be great help:-)

No problem. Here is an example:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var lon = -105.0;
var lat = 40.0;
var coneHeight = 4000.0;

viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(lon, lat, coneHeight),
point : {
pixelSize : 10,
color : Cesium.Color.YELLOW
}
});

viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(lon, lat, coneHeight/2.0),
cylinder : {
length : coneHeight,
topRadius : 0.0,
bottomRadius : 2000.0,
material : Cesium.Color.RED
}
});

viewer.zoomTo(viewer.entities);

``

-Hannah

Cool! great example:-)
I tested it successfully!

sorry to bother you again.
do you know how to rotated the cone with heading/pitch/roll from its apex, instead of from its center?

I checked this link https://groups.google.com/forum/#!topic/cesium-dev/f9ZiSWPMgus

But it seems the code only work with

Cesium.Math.toRadians(0.0),
Cesium.Math.toRadians(0.0),
Cesium.Math.toRadians(90.0)

,if I change it to another heading,pitch,roll, it won’t work.

Thanks!

Tudou

Hello,

You can use the orientation property to rotate the cone. Here is an example:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var position = Cesium.Cartesian3.fromDegrees(-105.0, 40.0, 200000.0);
var heading = Cesium.Math.toRadians(135);
var pitch = 45;
var roll = 0;
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);

var redCone = viewer.entities.add({
name : ‘Red cone’,
position: position,
orientation : orientation,
cylinder : {
length : 400000.0,
topRadius : 0.0,
bottomRadius : 200000.0,
material : Cesium.Color.RED
}
});

viewer.zoomTo(viewer.entities);

``

Best,

Hannah

hmm,

But the orientation property will rotate the cone from its center, not from its apex.
I think we still need some translation, but I don’t know how to do this.