Hello,
Actually, I just found out that it is not currently possible to do a non-uniform scale using CZML or entities. I’ve created an issue here: https://github.com/AnalyticalGraphicsInc/cesium/issues/2922
Meanwhile, if you don’t need to use the entities layer, you can do a non-uniform scale on a model using a model matrix. Here’s an example that I modified from from the development/3D models sandcastle example
function createModel(url, height, heading, pitch, roll) {
var origin = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);
var modelMatrix = Cesium.Matrix4.multiply(
Cesium.Transforms.headingPitchRollToFixedFrame(origin, heading, pitch, roll),
Cesium.Matrix4.fromScale(new Cesium.Cartesian3(1.0, 2.0, 3.0)), //Apply non-uniform scale of scaleX=1, scaleY=2, scaleZ=3
new Cesium.Matrix4());
scene.primitives.removeAll(); // Remove previous model
var model = scene.primitives.add(Cesium.Model.fromGltf({
url : url,
modelMatrix : modelMatrix,
minimumPixelSize : 128
}));
model.readyPromise.then(function(model) {
// Play and loop all animations at half-speed
model.activeAnimations.addAll({
speedup : 0.5,
loop : Cesium.ModelAnimationLoop.REPEAT
});
var camera = viewer.camera;
// Zoom to model
var controller = scene.screenSpaceCameraController;
var r = 2.0 * Math.max(model.boundingSphere.radius, camera.frustum.near);
controller.minimumZoomDistance = r * 0.5;
var center = Cesium.Matrix4.multiplyByPoint(model.modelMatrix, model.boundingSphere.center, new Cesium.Cartesian3());
var heading = Cesium.Math.toRadians(230.0);
var pitch = Cesium.Math.toRadians(-20.0);
camera.lookAt(center, new Cesium.HeadingPitchRange(heading, pitch, r * 2.0));
});
}
``
-Hannah