Hi,
Model selection, selection Indicator and showing the selected item information on InfoBox is not working, when I load the model using Cesium.Model.fromGltf(…). But If I add it to the entities i.e. (viewer.entities.add({…}) The selection and the info box is working.
Find the sandcastle code below.
var viewer = new Cesium.Viewer(‘cesiumContainer’,{
scene3DOnly: true,
infoBox : true,
selectionIndicator : true
});
var scene = viewer.scene;
var height = 5000.0;
var heading = 0.0;
var pitch = Cesium.Math.toRadians(10.0);
var roll = Cesium.Math.toRadians(-20.0);
var origin = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);
var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, heading, pitch, roll);
var model = scene.primitives.add(Cesium.Model.fromGltf({
url : ‘…/…/SampleData/models/CesiumAir/Cesium_Air.gltf’,
name: 'CESIUM AIR',
modelMatrix : modelMatrix,
minimumPixelSize : 128,
allowPicking : true
}));
viewer.trackedEntity = model;
model.readyPromise.then(function(model) {
// Play and loop all animations at half-speed
model.activeAnimations.addAll({
speedup : 0.1,
loop : Cesium.ModelAnimationLoop.REPEAT
});
}).otherwise(function(error){
window.alert(error);
});
``
Does anyone have a suggestion what I am doing wrong here?
Regards,
Premkumar.