It’s OK that it takes a few seconds to load, but a progress indicator might be nice, such as x% loaded on a div off to the side. You might have to carefully place each building. I made a SandCastle that allows one to move an entity in any cardinal direction either 1 meter or 10 meters which might help, it prints the new location in the console. I’d like to do the same for orientation, but I don’t know how to get that. To get position I have to use a private property: thebox._position._value . I’m not sure yet about orientation, thebox._orientation._value doesn’t work. Sure would be nice to have access to entity modelMatrix .
var viewer = new Cesium.Viewer(‘cesiumContainer’);
var CC3 = Cesium.Cartesian3;
var magnitude = 1;
var thebox = viewer.entities.add({
name : 'building',
position: Cesium.Cartesian3.fromDegrees(-90.1922703175, 38.6286636758, 30),
box : {
dimensions : new Cesium.Cartesian3(40, 30, 60),
material : Cesium.Color.RED,
outline : true,
outlineColor : Cesium.Color.BLACK
}
});
viewer.zoomTo(viewer.entities);
function getVector(name)
{
var GD_full_transform = Cesium.Transforms.eastNorthUpToFixedFrame(thebox._position._value, viewer.scene.globe.ellipsoid, new Cesium.Matrix4());
var GD_rot_transform = Cesium.Matrix4.getRotation(GD_full_transform,new Cesium.Matrix3());
if(name=="east"){return Cesium.Matrix3.getColumn(GD_rot_transform,0,new CC3());}
if(name=="north"){return Cesium.Matrix3.getColumn(GD_rot_transform,1,new CC3());}
if(name=="up"){return Cesium.Matrix3.getColumn(GD_rot_transform,2,new CC3());}
}
function move(scalar,unitVector)
{
var mycarte = thebox._position._value;
var relMove = CC3.multiplyByScalar(unitVector,scalar,new CC3());
CC3.add(mycarte,relMove,mycarte);
thebox.position = mycarte;
var mycarto = new Cesium.Cartographic();
mycarto = viewer.scene.globe.ellipsoid.cartesianToCartographic(thebox._position._value);
console.log("lon "+mycarto.longitude/Math.PI*180);
console.log("lat "+mycarto.latitude/Math.PI*180);
console.log("alt "+mycarto.height);
}
Sandcastle.addToolbarButton(‘magnitude 1’, function()
{magnitude=1;});
Sandcastle.addToolbarButton(‘magnitude 10’, function()
{magnitude=10;});
Sandcastle.addToolbarButton(‘east’, function()
{move(magnitude,getVector(“east”));});
Sandcastle.addToolbarButton(‘west’, function()
{move(-magnitude,getVector(“east”));});
Sandcastle.addToolbarButton(‘north’, function()
{move(magnitude,getVector(“north”));});
Sandcastle.addToolbarButton(‘south’, function()
{move(-magnitude,getVector(“north”));});
Sandcastle.addToolbarButton(‘up’, function()
{move(magnitude,getVector(“up”));});
Sandcastle.addToolbarButton(‘down’, function()
{move(-magnitude,getVector(“up”));});
``