Fix for glitch when entering inAir state from takeoff.

This was due to a frame lag of blend factor used for inAir blending.  So the first frame the upward velocity would be 0, followed by 3.5 m/s the next frame.
This is fixed by using the workingVelocity instead of _lastVelocity to drive the blend.
This commit is contained in:
Anthony Thibault 2018-09-04 14:36:56 -07:00
parent b92d1061c4
commit e210fadc7c

View file

@ -926,7 +926,7 @@ void Rig::computeMotionAnimationState(float deltaTime, const glm::vec3& worldPos
// compute blend based on velocity
const float JUMP_SPEED = 3.5f;
float alpha = glm::clamp(-_lastVelocity.y / JUMP_SPEED, -1.0f, 1.0f) + 1.0f;
float alpha = glm::clamp(-workingVelocity.y / JUMP_SPEED, -1.0f, 1.0f) + 1.0f;
_animVars.set("inAirAlpha", alpha);
}