Getting the current position of a billboard?

Hey guys,

Is there a way we can get the position of a billboard in a CzmlDataSource object? I want to draw a line from the billboard (with its offsets) to where the CzmlDataSource actual location is. Is there a way to draw a line that extends toward to these two positions? Thanks!

Oh I forgot to add. I been looking into polylines, but it expects a cartesian3, which is why I am curious if there is a way to get the billboard's current position after it's affected by the offsets.

I don’t know exactly how it is wired up to the datasource/entity API, but you probably want computeScreenSpacePosition.

Patrick

Hi Patrick!

Yes, that is for BIllboards... =( But from an entity, all i get back is a BillboardGraphic, which doesn't have that method. Is this achievable through an entity?

If not that, perhaps is there a way to draw a line with cartesian2 (X and Y of the Canvas) ?

As it turns out, this is really what I needed:

computeScreenSpacePosition

Just like Patrick said. On the ending, I went to the Sandcastle's "Picking" demo and followed the "Show Cartographic Position on Mouse Over" method to convert the X and Y coordinates (based on canvas) into Cartesian3 (long, lat, height).

Thanks Cesium!!

Here is for those who may need it in future.

var myPosition = billboard.computeScreenSpacePosition(scene);
// Returns X and Y of canvas... top-left screen being (0,0)
var cartesian = scene.camera.pickEllipsoid(myPosition, ellipsoid);
// Takes the X and Y based on canvas and converts it to x,y,z of the map
var cartographic = ellipsoid.cartesianToCartographic(cartesian);
// Takes x,y,z of map and converts to long,lat,height