Hello thanks for your interest. My code:
function Maquette(){
var positions = new Float64Array(4 * 3);
var A={x:0,y:3.5,z:0};
var B={x:1.500,y:-1.000,z:0};
var D={x:-1.500,y:-1.000,z:0};
var E={x:0,y:-1.000,z:1.500};
positions[0] = A.x;
positions[1] = A.y;
positions[2] = A.z;
positions[3] = B.x;
positions[4] = B.y;
positions[5] = B.z;
positions[6] = D.x;
positions[7] = D.y;
positions[8] = D.z;
positions[9] = E.x;
positions[10] = E.y;
positions[11] = E.z;
var indices = new Uint16Array(4 * 3);
// back triangle AEB
indices[0] = 0;
indices[1] = 3;
indices[2] = 1;
// left triangle EAD
indices[3] = 3;
indices[4] = 0;
indices[5] = 2;
// right triangle EDB
indices[6] = 3;
indices[7] = 2;
indices[8] = 1;
// bottom triangle BAD
indices[9] = 1;
indices[10] = 0;
indices[11] = 3;
var attributes = new Cesium.GeometryAttributes({
position : new Cesium.GeometryAttribute({
componentDatatype : Cesium.ComponentDatatype.DOUBLE,
componentsPerAttribute : 3,
values : positions
})
});
var geometryPleine = Cesium.GeometryPipeline.computeNormal(new Cesium.Geometry({
attributes: attributes,
indices: indices,
primitiveType: Cesium.PrimitiveType.TRIANGLES,
boundingSphere: Cesium.BoundingSphere.fromVertices(positions)
}));
return geometryPleine;
}
function MonAvion(){
this.position=new Cesium.Cartographic.fromDegrees(45, 45,10000);
this.route=0;
this.inclinaison=0;
this.pente=0;
var modelMatrix = this.getModelMatrix();
var instancePleine = new Cesium.GeometryInstance({
geometry : Maquette(),
attributes : {
color : new Cesium.ColorGeometryInstanceAttribute(0,0.6,0,0.4)
}
});
this.primitivePleine=new Cesium.Primitive({
geometryInstances : instancePleine,
appearance : new Cesium.PerInstanceColorAppearance({
translucent : true
}),
asynchronous:false
});
this.primitivePleine.modelMatrix=modelMatrix;
primitives.add(this.primitivePleine);
}
MonAvion.prototype.getModelMatrix=function(){
var quatRoute=Cesium.Quaternion.fromAxisAngle(Cesium.Cartesian3.UNIT_Z,this.route);
var quatInclinaison=Cesium.Quaternion.fromAxisAngle(Cesium.Cartesian3.UNIT_Y,this.inclinaison);
var quatPente=Cesium.Quaternion.fromAxisAngle(Cesium.Cartesian3.UNIT_X,this.pente);
var quaternion=Cesium.Quaternion.multiply(Cesium.Quaternion.multiply(quatRoute,quatPente),quatInclinaison);
var myTransformMatrix=Cesium.Matrix4.fromTranslationQuaternionRotationScale(
new Cesium.Cartesian3(0, 0, 0),
quaternion,
new Cesium.Cartesian3(300, 300, 300)
);
return Cesium.Matrix4.multiply(Cesium.Transforms.eastNorthUpToFixedFrame(ellipsoid.cartographicToCartesian(this.position)),myTransformMatrix);
};
MonAvion.prototype.update=function(options){
options = Cesium.defaultValue(options, Cesium.defaultValue.EMPTY_OBJECT);
this.position=Cesium.defaultValue(options.position, this.position);
this.route=Cesium.defaultValue(options.route, this.route);
this.inclinaison=Cesium.defaultValue(options.inclinaison, this.inclinaison);
this.pente=Cesium.defaultValue(options.pente, this.pente);
this.primitivePleine.modelMatrix=this.getModelMatrix();
};
var avion=new MonAvion();