帮忙看下这段代码,为什么加上 polylines.modelMatrix =m; 之后线条就不会显示了
var polylines = new Cesium.PolylineCollection();
polylines.add({
positions: Cesium.Cartesian3.fromDegreesArrayHeights([
110.254715, 22.871616, 959.058, 110.264715, 22.881616, 1024,
]),
width: 10,
material: Cesium.Material.fromType("Color", {
color: Cesium.Color.BLUE,
}),
});
polylines.add({
positions: Cesium.Cartesian3.fromDegreesArrayHeights([
110.254715, 22.871616, 959.058, 110.244715, 22.861616, 1032,
]),
width: 4,
material: Cesium.Material.fromType("Color", {
color: Cesium.Color.RED,
}),
});
var position = Cesium.Cartesian3.fromDegrees(
110.254715,
22.871616,
959.058
);
var heading = Cesium.Math.toRadians(30);
var pitch = Cesium.Math.toRadians(20);
var roll = Cesium.Math.toRadians(10);
var headingPitchRoll = new Cesium.HeadingPitchRoll(heading, pitch, roll);
//var m =Cesium.Transforms.eastNorthUpToFixedFrame(position);
var m = Cesium.Transforms.headingPitchRollToFixedFrame(
position,
headingPitchRoll,
Cesium.Ellipsoid.WGS84,
Cesium.Transforms.eastNorthUpToFixedFrame,
new Cesium.Matrix4()
);
console.log(m);
//polylines.modelMatrix =m;
viewer.scene.primitives.add(polylines);
显示效果
你先看看m是不是null