AnalyticalGraphicsInc / czml-writer

A library for writing CZML content for use with Cesium.
Other
390 stars 142 forks source link

Animate viewFrom (Cesium czml) #150

Open misterbighead opened 6 years ago

misterbighead commented 6 years ago

I would like to move my camera smoothly around my aircraft. With viewer.trackedEntity = airplane, I have tried including multiple camera positions in czml:

"viewFrom" : {
    "epoch" : "2012-08-04T16:00:00Z",
    "cartesian" : [
    0, 100.0, 100.0, 100.0,
    100, 200.0, 200.0, 200.0
    ]
}

But the camera stays locked in one position. Shouldn't this work? (https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/ViewFrom says "Interpolatable: yes")

Or is there a way to animate viewer.camera.position dynamically?

shunter commented 6 years ago

viewFrom only affects the initial camera view when the entity becomes tracked in the viewer. If it was applied every frame, it would lock out interactive mouse control. The property does depend on time, so the value will be calculated using the current simulation time, which means you could have different initial offsets at different times, though this is of limited usefulness, admittedly.

More complete programmatic camera control is something we'd like to add in the future.

misterbighead commented 6 years ago

What is the most elegant way to animate the camera to move smoothly?

custompro12 commented 4 years ago

applied every frame, it would lock out interactive mouse control

It seems intuitive from the docs and from how the position interpolation works that this would be the default behavior and I think this would satisfy our "pan camera smoothly around tracked entity" use case.

only affects the initial camera view when the entity becomes tracked

Maybe this should be an opt-in/out behavior provided by some other viewFrom parameter

mhaberler commented 3 years ago

viewFrom only affects the initial camera view when the entity becomes tracked in the viewer. If it was applied every frame, it would lock out interactive mouse control. The property does depend on time, so the value will be calculated using the current simulation time, which means you could have different initial offsets at different times, though this is of limited usefulness, admittedly.

More complete programmatic camera control is something we'd like to add in the future.

I think being able to tie camera view to an InterpolatableProperty would be very useful