I have a model that is rotated in the wrong direction by default and I need helpt with position of the model, I've solved it by changing the modelMatrix on each update but i feel like there must be some way to change the modelMatrix when I create the entity and then forget about it.
So my question boils down to this: Is there any way to change a Models Matrix on/before adding it to the scene?
The code I'm using a the moment to add the entity.
createModelAndFlight = function(flinfo, p, id) {
var positions = p.property,//Cesium.SampledPositionProperty
start = Cesium.JulianDate.fromDate(new moment(flinfo.departureDate.dateUtc).toDate()),
stop = Cesium.JulianDate.fromDate(new moment().add(200, 'minutes').utc().toDate());
var model = new Cesium.ModelGraphics({
uri : './models/CesiumAir/Cesium_Air.gltf',
scale: 150,
minimumPixelSize: 100,
maximumPixelSize: 150,
pickPrimitive: true,
show: true,
runAnimations: false
});
//Actually create the entity
var entity = new Cesium.Entity({
name : id,
//Set the entity availability to the same interval as the simulation time.
availability : new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({
start : start,
stop : stop
})]),
//Use our computed positions
position : positions,
//Automatically compute orientation based on position movement.
orientation: new Cesium.VelocityOrientationProperty(positions),
//Load the Cesium plane model to represent the entity
model: model
});
viewer.entities.add(entity);
return entity;
};