How to change billboard rotation after added to entity?

I created a billboard here:

var bluePin = scope.cesium.entities.add({

name : ‘Blank blue pin’,

position : Cesium.Cartesian3.fromDegrees(posInfo.lon, posInfo.lat),

billboard : {

image : pinBuilder.fromColor(Cesium.Color.ROYALBLUE, 48).toDataURL(),

verticalOrigin : Cesium.VerticalOrigin.BOTTOM,

rotation: 0

}

});

I want to be able to click a button and change rotation of the bluePin to 180 degrees. When do I:

bluePin.position = new position

It changes position. But the following do not work:

bluePin.rotation = 180

bluePin.orientation.rotation = 180

What can I do?

Did you try bluePin.billboard.rotation = 180 ?

Angle in Cesium are always in radians unless specifically noted in the function name. So while Hyper has the correct code, the units are wrong. What you’ll want is:

bluePin.billboard.rotation = Cesium.Math.toRadians(180);

Oh ya, thanks, I forgot about that. Could also convert by multiplying by Math.PI/180, but .toRadians does make the code more readable.

Thanks Hyper and Matt, especially Matt, that did the it!