mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 19:14:59 +02:00
set phase to 0.0
This commit is contained in:
parent
220dbf586f
commit
0cc302f68c
1 changed files with 11 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue