Learn the basics of the model of Cesium.
#primitve way to load model
// Cesium.Transforms.eastNorthUpToFixedFrame to create a latitude and longitude as the origin enu (east-north-up) local coordinate system.
varmodelmatrix = Cesium.Transforms.eastNorthUpToFixedFrame (Cesium.Cartesian3.fromDegrees (118,31,1000)); varModel =viewer.scene.primitives.add ( Cesium.Model.fromGltf ({ URL: "../ Data / Models /CesiumAir/Cesium_Air.glTF ", modelMatrix: modelmatrix,
// model size factor Scale:100,
// clipping plane clippingPlanes: clippingplans }));
# Model sports show
//设置开始时间
var startTime = new Cesium.JulianDate.now();
//加载后activeAnimations.addAll({}) Cesium.when(model.readyPromise).then(function(model){ model.activeAnimations.addAll({
//the style of thr model movement,thiS MIRRORED_REPEAT style means "moving clockwise and then moving anti-clockwise" loop:Cesium.ModelAnimationLoop.MIRRORED_REPEAT, startTime:startTime,
//stopTime: startTime,stoptime(seconds),create new time (new Cesium.JulianDate()) stopTime:Cesium.JulianDate.addSeconds(startTime,10,new Cesium.JulianDate()) }) });
#clippingPlane
the core :ax+by+cz=d; a,b,c,d is four parameters
try to understand this by mathmatics
var clippingPlane= new Cesium.ClippingPlane(new Cesium.Cartesian3(0,1,0),0);//(a,b,c),d var clippingplans = new Cesium.ClippingPlaneCollection({ planes:[clippingPlane] });
#pick the model
var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); handler.setInputAction(function(movement){ var pick = scene.pick(movement.endPosition); if (Cesium.defined(pick) && Cesium.defined(pick.node) ) { console.log('node: ' + pick.node.name + '. mesh: ' + pick.mesh.name); } },Cesium.ScreenSpaceEventType.MOUSE_MOVE)