cesium-sensor material remains undefined

I’m running the following script and get no errors but testCone.conicSensor.lateralSurfaceMaterial is undefined after the assignment. I’ve checked and coneSide is defined and I’ve tried assigning the material directly but it remains undefined. Anyone seen this before?

var testCone = viewer.entities.add({

name: ‘test cone’,

show: true,

position: Cesium.Cartesian3.multiplyByScalar(new Cesium.Cartesian3(0,0,1),6500000,new Cesium.Cartesian3())

});

testCone.addProperty(‘conicSensor’);

testCone.conicSensor = new CesiumSensors.ConicSensorGraphics();

testCone.conicSensor.intersectionColor = new Cesium.ConstantProperty(Cesium.Color.RED);

testCone.conicSensor.showIntersection = true;

testCone.conicSensor.radius = 1000000; //maximum cone projection distance in m

testCone.conicSensor.innerHalfAngle = Math.PI / 2;

var coneSide = Cesium.Material.fromType(‘Color’);

coneSide.uniforms.color = new Cesium.Color(0.0, 1.0, 1.0, 0.5);

testCone.conicSensor.lateralSurfaceMaterial = coneSide;

Hello,
do you use the sensor plugin or cesium pro?

cesium plugin

sorry, I meant sensor plugin

ok do you mean testCone.conicSensor.lateralSurfaceMaterial is undefined?
This attribute is waiting a property data and not a material for me.

sorry, I meant sensor plugin

cesium plugin

Hello,
do you use the sensor plugin or cesium pro?

var testCone = viewer.entities.add({

name: ‘test cone’,

show: true,

position: Cesium.Cartesian3.multiplyByScalar(new Cesium.Cartesian3(0,0,1),6500000,new Cesium.Cartesian3())

});

testCone.addProperty(‘conicSensor’);

testCone.conicSensor = new CesiumSensors.ConicSensorGraphics();

testCone.conicSensor.intersectionColor = new Cesium.ConstantProperty(Cesium.Color.RED);

testCone.conicSensor.showIntersection = true;

testCone.conicSensor.radius = 1000000; //maximum cone projection distance in m

testCone.conicSensor.innerHalfAngle = Math.PI / 2;

var coneSide = Cesium.Material.fromType(‘Color’);

coneSide.uniforms.color = new Cesium.Color(0.0, 1.0, 1.0, 0.5);

testCone.conicSensor.lateralSurfaceMaterial = coneSide;

I’m running the following script and get no errors but testCone.conicSensor.lateralSurfaceMaterial is undefined after the assignment. I’ve checked and coneSide is defined and I’ve tried assigning the material directly but it remains undefined. Anyone seen this before?

ok do you mean testCone.conicSensor.lateralSurfaceMaterial is undefined?
This attribute is waiting a property data and not a material for me.

I don’t understand the distinction you’re making here. Is testCone.conicSensor.lateralSurfaceMaterial not a material? Can you give an example of how to assign a value to it?

Hi Jason,

Check out this example here. I’m not completely sure what value is being inserted programatically by your code, but maybe comparing the value of what coneSide is inserting to the hard-coded value in that example might help.

The example go linked has

"lateralSurfaceMaterial":{
  "solidColor":{
    "color":{
      "rgba":[
        255,0,255,51
      ]
    }
  }
}

``

I thought that czml snippet is equivalent to

var coneSide = Cesium.Material.fromType(‘Color’);

coneSide.uniforms.color = new Cesium.Color(1.0, 0.0, 1.0, 0.5);

``

What am I missing here?

check https://github.com/kaktus40/cesium-sensors :

entity.conicSensor = new CesiumSensorVolumes.ConicSensorGraphics();
entity.conicSensor.intersectionColor = new Cesium.ConstantProperty(new Cesium.Color(0.1, 0.2, 0.3, 0.4));

Thanks that fixed that problem. But I’m still not seeing the sensor. No errors, everything seems to be assigned just fine. Here’s the snippet:
var testCone = viewer.entities.add({

name: ‘test cone’,

show: true,

position: new Cesium.Cartesian3(4650397.56551457, -3390535.52275848, -4087729.48877329)

});

testCone.addProperty(‘conicSensor’);

testCone.conicSensor = new CesiumSensors.ConicSensorGraphics();

testCone.conicSensor.show = true;

testCone.conicSensor.intersectionColor = new Cesium.ConstantProperty(Cesium.Color.RED);

testCone.conicSensor.showIntersection = true;

testCone.conicSensor.radius = 10000000; //maximum cone projection distance in m

testCone.conicSensor.innerHalfAngle = Math.PI / 2;

testCone.conicSensor.maximumClockAngle = 2 * Math.PI;

testCone.conicSensor.minimumClockAngle = 0;

var coneSide = Cesium.Material.fromType(‘Color’);

coneSide.uniforms.color = new Cesium.Color(255, 0, 0, 255);

testCone.conicSensor.lateralSurfaceMaterial = new Cesium.ConstantProperty(coneSide);

``

Did you test with lesser innerHalfAngle and ``maximumClockAngle?
Int his sample, I used customSensor: https://github.com/kaktus40/cesium-sensors/blob/master/examples/simple.html

Yes, I’ve tried a variety of min and max clock angles, as well as orientations. No joy.

You need to specify an outerHalfAngle for the ConicSensorGraphics

testCone.conicSensor.outerHalfAngle = Math.PI / 2;

Also note that if no orientation property is applied to the entity, then the ConicSensorVisualizer.show flag will revert to false:

https://github.com/jlouns/cesium-sensor-volumes/blob/master/lib/conic/conic-sensor-visualizer.js#L129

Yep. I figured it out and forgot to come back to this thread. I was misunderstanding the terminology. For what I was trying to do, I needed to use the outerHalfAngle and set the innerHalfAngle to zero.