How to make Viewer track a 3D model?

1. A concise explanation of the problem you’re experiencing.

I am flying an airplane model through different waypoints. I am sampling the path at regular intervals and creating a SampledPositionProperty at each interval. I would like the Cesium camera to track the plane model, however, since it is time dependent, I don’t know how to “switch” to the new entity when it’s time comes to activate. I know I could add all these positions to just one path, but I don’t want to do that. It is important to retain different paths.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

var waypointPath = viewer.entities.add({
availability: new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({
start: startTime,
stop: currentTime
})]),
position: waypointSampledPositions,
orientation: new Cesium.VelocityOrientationProperty(waypointSampledPositions),
model: {
uri: ‘…/assets/models/CesiumAir/Cesium_Air.glb’,
minimumPixelSize : 64
},
path : {
resolution : 1,
material : myPathMaterial,
width : 3
}
});

waypointPath.position.setInterpolationOptions({
interpolationDegree : 5,
interpolationAlgorithm : Cesium.LagrangePolynomialApproximation
});

viewer.zoomTo(waypointPath);

viewer.timeline.zoomTo(startTime, currentTime);

flightWaypointPaths.push(waypointPath);

``

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I want to be able to put the camera at the nose of the plane, and get a “Pilot POV” along the flight path.

4. The Cesium version you’re using, your operating system and browser.

Cesium 1.58, Windows 10, Google Chrome/Mozilla Firefox.

I m sorry but i cant run this.i dont know where make s mistake

28 Haz 2019 Cum 16:50 tarihinde Sanjeet Suhag suhagsanjeet@gmail.com şunu yazdı:

hello sanjeet
can you help me about this demo https://demos.cesium.com/vricon-geoint/

ı want to do same but ı cant do it.

muhammed aldemir galataarda2009@gmail.com, 28 Haz 2019 Cum, 18:25 tarihinde şunu yazdı:

Sanjeet,

Are you using viewer.trackedEntity to track your airplane model? I think one way would be to create a postUpdate event, to check every frame what interval the timeline is in, and use that to figure out which entity it should be following.

This VR code example does something similar to position the camera inside the hot-air balloon and allow you to look around while in VR mode:

https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Cardboard.html

Let me know if this helps!

Muhammed, to keep this thread on-topic, feel free to create a new thread for your question and I’d be happy to take a look there.