better anim function
this is more efficient AND it'll produce more consistent results when starting an animation between tempo changes :D (it no longer iterates through a list twice)
This commit is contained in:
parent
cb4a3c5122
commit
d696f53e63
|
|
@ -66,8 +66,8 @@ namespace HeavenStudio.Util
|
|||
if (!double.IsNaN(startBeat)) {
|
||||
var cond = Conductor.instance;
|
||||
var animClip = Array.Find(anim.runtimeAnimatorController.animationClips, x => x.name == animName);
|
||||
double animLength = cond.GetBeatFromSongPos(cond.GetSongPosFromBeat(startBeat) + animClip.length);
|
||||
pos = cond.GetPositionFromBeat(startBeat, animLength - startBeat) * timeScale;
|
||||
double animLength = cond.SecsToBeats(animClip.length, cond.GetBpmAtBeat(startBeat));
|
||||
pos = cond.GetPositionFromBeat(startBeat, animLength) * timeScale;
|
||||
} else {
|
||||
Debug.LogWarning("DoScaledAnimationFromBeatAsync()'s startBeat was NaN; using DoScaledAnimationAsync() instead.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue