CesiumGS / CesiumGS/cesium

ModelAnimation added with startTime in the past isn't set to final state of animation

Open
#10,048 1 comment 0 reactions 0 assignees View on GitHub
category - model/gltf type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

If a ModelAnimation is added with a startTime in the past (i.e. startTime + duration < viewer.clock.currentTime), it appears that it is ignored, rather than having the state of the model being updated to the last frame of the animation.

Here's an example using an aircraft. When the propeller animation is started 2 seconds before the current time, the propeller isn't moved at all. If you change the startTime to the currentTime, it is.

[Sandcastle example](https://sandcastle.cesium.com/#c=jVXbjts2EP2VgR8SGdFSsr1JGl8W3e7mIUWLBnDRJwEGLY5sZinSICl7t8X+e4e62psEiV80nDlzOFf6yC0cJZ7Qwgo0nuAOnaxK9k+ti7JRXp/vjPZcarTZKIb/Mg0gdWF+M49zKLhyGAeVQ4W5l0Z/0kLm3Bt7Yd1zYU5uDt5WncZUStxqWXKPvf55vMh0potK11ywQ39L0hEbIKlc1EQcA2ov/dO4iQjgSMkcrCxlgDtKqMExl6NGNlgWA1yh3vk9QQcra3QtqDA2CkBJmHRBn2XrQ/KbN/3VX11/SUlJRHK8GLCygKi3MylgtVq16cCrV2c0UjvPdY6m6FrzpxGoLkDMIhdPF7GEn0VfWX0G4y/qeBbPcyO2n9az0gIL6rog4HNoSp2hcbJuzKoL6I5bTxLXM1ZYU97jziK6KFBdTaYzlr6/vn43+VD3/PqapW/T2fv0XX18m6YpSzPd9DzQtzXoe1efJZWQCxHVCWpe0rRko4PiGmkeg64Lat5LcSAEKEOx5l1lKiuDJ2PJmpcHhffc86SGuKRJ5lbaVtqQyHZq295AVJIKV5Wf5SOqtfyXYphMf+ls/DHY1jlXpJ9SVmlrsZUeCt7uQ7A8d6Pe5uktzx9QfOzSb+pwuQo0Cdb3bFHb8FA13l9Brj+xMYumOkkCnwo4YcM8sNDUgd8jHLjzcS2dmZx+7WnXPXgD0r92QCPCVaDwSAm3vKc9WmxIrDk4OEmlYM9poreIGqwJcNGCP7Idg9yUB976nFPS5A80lZN6V5/9yTRh/y1LWvYtKnNq6e5NCFEjihBj5UJ+5hBwcEW+3MOXynlq2gM5Sg/InaQHkLAOEYQsCoqddi6Uob62K3N/3zD8v1eKJp8GCcOErjE3WnTlZrky+QPLK0t0tV8MV9P4/J0d3KNx8z4kycubvke2GMJqs/tBVD1pDCmb/CCOYaSG1RuW7zOV5baeyk0QN5vppl+U/pr5IPamJtJ5L9W7MO4eGGre+sUo8sJTb2bUmjqJTNPoBUdT+ehyIWKY0d4FrlE8Wjr/pPCme+F+leXBEG9lVUTr75HWn5J1ybaitfMsd657npfJuetSyCNIsfrGPyHkijtHlqJS9YuQjW6WCeG/clWGC5rbv45oFX8KsP3k5o9GyRhbJnT8tqc3Rm25fcH8Pw)

This isn't a great example - as you probably wouldn't care about where a prop ends up. But if this aircraft had a landing gear animation - then it would make a very obvious difference, as the landing gear might be up instead of down.

Note that the animation is played if the animation time line is rewound. It's just not being taken in to consideration when it is initially added.

Contributor guide

Open the contributing guide

Research direction

Start with the linked Sandcastle example and trace how ModelAnimation uses startTime, duration, viewer.clock.currentTime, and the animation timeline when it is initially added. Reproduce the aircraft case with an already-finished animation, then verify that the model reflects the animation's final frame immediately and still behaves correctly when the timeline is rewound.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.