Skip to content

Animation timescaling#17

Open
PieBob851 wants to merge 10 commits intoyamEater20:mainfrom
PieBob851:animation-timescaling
Open

Animation timescaling#17
PieBob851 wants to merge 10 commits intoyamEater20:mainfrom
PieBob851:animation-timescaling

Conversation

@PieBob851
Copy link
Contributor

Adds event. Components with an animator can subscribe to this event and update the animator.speed value to have animations play at the correct timescale.

@PieBob851
Copy link
Contributor Author

Notably, getTimeScale() had the code updating timescale code refactored into updateTimeScale(). During this change, instead of using unity deltaTime (which I wrongly used initially to represent time since last time timescale was updated), I correctly calculated the time elapsed since last update.

The timeAcceleration value has been changed to roughly match the feel of this, and timeAcceleration now has a more intuitive representation - timeAcceleration of 4 means changing timescale by a factor of 4 takes essentially 1 second (not exactly because of the calculation occurs).

This still has an issue of repeated multiplication at different rates being a slightly different curve to exponentiation. A better approach would be to simply use an exponential curve with timeAcceleration representing the maximum change in timeScale factor in 1second.

…e factor at which time can change in 1 second.
@PieBob851
Copy link
Contributor Author

TimeAcceleration now follows an exponential curve instead of mimicking it with repeated multiplication, so it no longer has any issues with updating on a potentially non-constant time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant