set phase to 0.0

This commit is contained in:
amantley 2018-08-23 17:28:38 -07:00
parent 220dbf586f
commit 0cc302f68c

View file

@ -139,6 +139,8 @@ void AnimBlendLinearMove::setFrameAndPhase(float dt, float alpha, int prevPoseIn
auto nextClipNode = std::dynamic_pointer_cast<AnimClip>(_children[nextPoseIndex]);
assert(nextClipNode);
float v0 = _characteristicSpeeds[prevPoseIndex];
float n0 = (prevClipNode->getEndFrame() - prevClipNode->getStartFrame()) + 1.0f;
float v1 = _characteristicSpeeds[nextPoseIndex];
@ -153,9 +155,17 @@ void AnimBlendLinearMove::setFrameAndPhase(float dt, float alpha, int prevPoseIn
float f1 = nextClipNode->getStartFrame() + _phase * n1;
nextClipNode->setCurrentFrame(f1);
// integrate phase forward in time.
_phase += omega * dt;
qCDebug(animation) << "the _phase is " << _phase;
qCDebug(animation) << "the _phase is " << _phase << " and omega " << omega << _desiredSpeed;
if (_phase < 0.0f) {
_phase = 0.0f; // 1.0f + _phase;
}
// detect loop trigger events
if (_phase >= 1.0f) {
@ -173,7 +183,4 @@ void AnimBlendLinearMove::setCurrentFrameInternal(float frame) {
assert(clipNode);
const float NUM_FRAMES = (clipNode->getEndFrame() - clipNode->getStartFrame()) + 1.0f;
_phase = fmodf(frame / NUM_FRAMES, 1.0f);
if (_phase < 0.0f) {
_phase = 0.0f; // 1.0f + _phase;
}
}