Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for explicit control over model animations #9339

Merged
merged 6 commits into from
May 10, 2022

Commits on May 10, 2022

  1. Add support for explicit control over model animations

    Cesium currently only supports time based animation. This can
    be inconvenient if the phase of the animation is related to
    something other than time (eg distance along a path of an
    object moving at a variable speed).
    
    This came up before in CesiumGS#7361, but the author was persuaded that
    it was better to use nodeTransformations to explicitly control
    the model. That was (just) doable with that example, because
    there were just 3 pairs of wheels, all of which needed the
    exact same, relatively trivial, transformations. The proposed
    solution was also cumbersome, relying on modifying `multiplier`
    on the fly, with the downside that modifying multiplier also
    reset the phase of the animation.
    
    For more complex models, with less uniform animations, this
    approach isn't really doable - especially if you want the same
    code to work for multiple models.
    
    This adds an animationTime function to ModelAnimation. If set,
    it's used by ModelAnimationCollection.update to compute the
    localAnimationTime, rather than using the current clock time.
    
    I also added an animateWhilePaused property to
    ModelAnimationCollection. When false (the default), we continue
    to do the short circuit exit from ModelAnimationCollection.update
    when the scene time hasn't changed. When true, a suitable
    animationTime function can continue to animate the model, even when
    scene time is paused.
    
    The new sandcastle example is just a clone of Time Dynamic Wheels,
    rewritten to use Cesium_Man.glb, and the new functionality.
    markw65 committed May 10, 2022
    Configuration menu
    Copy the full SHA
    cd8bfda View commit details
    Browse the repository at this point in the history
  2. Review fixes

    - rename _prevAnimationTime to _prevAnimationDelta
    - rewrite the _prevAnimationDelta bailout
    - add a test that we animate while paused if animateWhilePaused is true, and update the existing test to check that we don't animate while paused when animateWhilePaused is false
    markw65 committed May 10, 2022
    Configuration menu
    Copy the full SHA
    933ac94 View commit details
    Browse the repository at this point in the history
  3. One more missed review fix

    Use `defined(scheduledAnimation.animationTime)`
    markw65 committed May 10, 2022
    Configuration menu
    Copy the full SHA
    34e471d View commit details
    Browse the repository at this point in the history
  4. Apply changes to ModelExperimental

    markw65 committed May 10, 2022
    Configuration menu
    Copy the full SHA
    125d154 View commit details
    Browse the repository at this point in the history
  5. Respond to code review

    markw65 authored and markw65 committed May 10, 2022
    Configuration menu
    Copy the full SHA
    47e7d9f View commit details
    Browse the repository at this point in the history
  6. More code review fixes

    markw65 committed May 10, 2022
    Configuration menu
    Copy the full SHA
    f8a859c View commit details
    Browse the repository at this point in the history