mirror of
https://github.com/lubosz/overte.git
synced 2025-04-26 19:35:48 +02:00
enabled/disable ik now works for the new animspline json
This commit is contained in:
parent
34d32eeda8
commit
a04e6d55ff
2 changed files with 23 additions and 9 deletions
libraries/animation/src
|
@ -82,7 +82,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const
|
|||
AnimPoseVec underPoses = _children[0]->evaluate(animVars, context, dt, triggersOut);
|
||||
|
||||
// if we don't have a skeleton, or jointName lookup failed or the spline alpha is 0 or there are no underposes.
|
||||
if (!_skeleton || _baseJointIndex == -1 || _midJointIndex == -1 || _tipJointIndex == -1 || alpha == 0.0f || underPoses.size() == 0) {
|
||||
if (!_skeleton || _baseJointIndex == -1 || _midJointIndex == -1 || _tipJointIndex == -1 || alpha < EPSILON || underPoses.size() == 0) {
|
||||
// pass underPoses through unmodified.
|
||||
_poses = underPoses;
|
||||
return _poses;
|
||||
|
@ -474,4 +474,4 @@ void AnimSplineIK::beginInterp(InterpType interpType, const AnimChain& chain) {
|
|||
_interpType = interpType;
|
||||
_interpAlphaVel = FRAMES_PER_SECOND / _interpDuration;
|
||||
_interpAlpha = 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1068,16 +1068,30 @@ void Rig::computeMotionAnimationState(float deltaTime, const glm::vec3& worldPos
|
|||
|
||||
t += deltaTime;
|
||||
|
||||
if (_enableInverseKinematics != _lastEnableInverseKinematics) {
|
||||
if (_enableInverseKinematics) {
|
||||
_animVars.set("ikOverlayAlpha", 1.0f);
|
||||
} else {
|
||||
_animVars.set("ikOverlayAlpha", 0.0f);
|
||||
}
|
||||
if (_enableInverseKinematics) {
|
||||
_animVars.set("splineIKEnabled", true);
|
||||
_animVars.set("leftHandIKEnabled", true);
|
||||
_animVars.set("rightHandIKEnabled", true);
|
||||
_animVars.set("leftFootIKEnabled", true);
|
||||
_animVars.set("rightFootIKEnabled", true);
|
||||
_animVars.set("leftHandPoleVectorEnabled", true);
|
||||
_animVars.set("rightHandPoleVectorEnabled", true);
|
||||
_animVars.set("leftFootPoleVectorEnabled", true);
|
||||
_animVars.set("rightFootPoleVectorEnabled", true);
|
||||
} else {
|
||||
_animVars.set("splineIKEnabled", false);
|
||||
_animVars.set("leftHandIKEnabled", false);
|
||||
_animVars.set("rightHandIKEnabled", false);
|
||||
_animVars.set("leftFootIKEnabled", false);
|
||||
_animVars.set("rightFootIKEnabled", false);
|
||||
_animVars.set("leftHandPoleVectorEnabled", false);
|
||||
_animVars.set("rightHandPoleVectorEnabled", false);
|
||||
_animVars.set("leftFootPoleVectorEnabled", false);
|
||||
_animVars.set("rightFootPoleVectorEnabled", false);
|
||||
}
|
||||
_lastEnableInverseKinematics = _enableInverseKinematics;
|
||||
}
|
||||
|
||||
}
|
||||
_lastForward = forward;
|
||||
_lastPosition = worldPosition;
|
||||
_lastVelocity = workingVelocity;
|
||||
|
|
Loading…
Reference in a new issue