I need to achieve a front view for the tracking entity, which will change according to the entities movements.
When I assign a value to
How can I do this for this example?
from Cesium: View from the front of the tracked entity
When I assign a value to
viewer.trackedEntity
property, the camera assumes a certain position. Is it possible to change this position so that the camera is directly in front of the tracking entity?How can I do this for this example?
var viewer = new Cesium.Viewer('cesiumContainer', {
infoBox: false,
selectionIndicator: false,
shouldAnimate: true,
terrainProvider: Cesium.createWorldTerrain()
});
var start = Cesium.JulianDate.fromDate(new Date(2015, 2, 25, 16));
var stop = Cesium.JulianDate.addSeconds(start, 360, new Cesium.JulianDate());
viewer.clock.startTime = start.clone();
viewer.clock.stopTime = stop.clone();
viewer.clock.currentTime = start.clone();
viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
viewer.clock.multiplier = 10;
viewer.timeline.zoomTo(start, stop);
var position = new Cesium.SampledPositionProperty();
position.addSample(start, Cesium.Cartesian3.fromDegrees(-118.243683, 34.052235, 500000));
position.addSample(Cesium.JulianDate.addSeconds(start, 250, new Cesium.JulianDate()),
Cesium.Cartesian3.fromDegrees(-110, 35.5, 500000));
position.addSample(Cesium.JulianDate.addSeconds(start, 500, new Cesium.JulianDate()),
Cesium.Cartesian3.fromDegrees(-86.134903, 40.267193, 500000));
var entity = viewer.entities.add({
availability : new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({
start : start,
stop : stop
})]),
position : position,
orientation : new Cesium.VelocityOrientationProperty(position),
model : {
uri : 'https://cesiumjs.org/Cesium/Apps/SampleData/models/CesiumAir/Cesium_Air.gltf'
,
minimumPixelSize : 64
},
path : {
resolution : 1,
material : new Cesium.PolylineGlowMaterialProperty({
glowPower : 0.1,
color : Cesium.Color.YELLOW
}),
width : 10
}
});
viewer.trackedEntity = entity;
<link href="https://cesiumjs.org/Cesium/Build/Cesium/Widgets/widgets.css" rel="stylesheet"/>
<script src="https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js"></script>
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar">
<div id="interpolationMenu"></div>
</div>
from Cesium: View from the front of the tracked entity
No comments:
Post a Comment