mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 10:06:57 +02:00
Merge pull request #16045 from hyperlogic/feature/reaction-intro-loop-outro
Higher quality standing and seated reactions
This commit is contained in:
commit
c2fbfd70c4
14 changed files with 1068 additions and 81 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
interface/resources/avatar/animations/sitting_emote_clap_all.fbx
Normal file
BIN
interface/resources/avatar/animations/sitting_emote_clap_all.fbx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
interface/resources/avatar/animations/sitting_talk04.fbx
Normal file
BIN
interface/resources/avatar/animations/sitting_talk04.fbx
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
@ -57,14 +57,12 @@ const AnimPoseVec& AnimRandomSwitch::evaluate(const AnimVariantMap& animVars, co
|
||||||
lowerBound = upperBound;
|
lowerBound = upperBound;
|
||||||
}
|
}
|
||||||
if (abs(_randomSwitchEvaluationCount - context.getEvaluationCount()) > 1) {
|
if (abs(_randomSwitchEvaluationCount - context.getEvaluationCount()) > 1) {
|
||||||
_duringInterp = false;
|
switchRandomState(animVars, context, desiredState, false);
|
||||||
switchRandomState(animVars, context, desiredState, _duringInterp);
|
|
||||||
} else {
|
} else {
|
||||||
// firing a random switch, be sure that we aren't completing a previously triggered transition
|
// firing a random switch, be sure that we aren't completing a previously triggered transition
|
||||||
if (currentStateHasPriority) {
|
if (currentStateHasPriority) {
|
||||||
if (desiredState->getID() != _currentState->getID()) {
|
if (desiredState->getID() != _currentState->getID()) {
|
||||||
_duringInterp = true;
|
switchRandomState(animVars, context, desiredState, true);
|
||||||
switchRandomState(animVars, context, desiredState, _duringInterp);
|
|
||||||
} else {
|
} else {
|
||||||
_duringInterp = false;
|
_duringInterp = false;
|
||||||
}
|
}
|
||||||
|
@ -79,8 +77,7 @@ const AnimPoseVec& AnimRandomSwitch::evaluate(const AnimVariantMap& animVars, co
|
||||||
// evaluate currentState transitions
|
// evaluate currentState transitions
|
||||||
auto transitionState = evaluateTransitions(animVars);
|
auto transitionState = evaluateTransitions(animVars);
|
||||||
if (transitionState != _currentState) {
|
if (transitionState != _currentState) {
|
||||||
_duringInterp = true;
|
switchRandomState(animVars, context, transitionState, true);
|
||||||
switchRandomState(animVars, context, transitionState, _duringInterp);
|
|
||||||
_triggerTime = randFloatInRange(_triggerTimeMin, _triggerTimeMax);
|
_triggerTime = randFloatInRange(_triggerTimeMin, _triggerTimeMax);
|
||||||
_randomSwitchTime = randFloatInRange(_randomSwitchTimeMin, _randomSwitchTimeMax);
|
_randomSwitchTime = randFloatInRange(_randomSwitchTimeMin, _randomSwitchTimeMax);
|
||||||
}
|
}
|
||||||
|
@ -172,6 +169,9 @@ void AnimRandomSwitch::switchRandomState(const AnimVariantMap& animVars, const A
|
||||||
_lastPlayedState = nextStateNode->getID();
|
_lastPlayedState = nextStateNode->getID();
|
||||||
if (shouldInterp) {
|
if (shouldInterp) {
|
||||||
|
|
||||||
|
bool interpActive = _duringInterp;
|
||||||
|
_duringInterp = true;
|
||||||
|
|
||||||
const float FRAMES_PER_SECOND = 30.0f;
|
const float FRAMES_PER_SECOND = 30.0f;
|
||||||
|
|
||||||
auto prevStateNode = _children[_currentState->getChildIndex()];
|
auto prevStateNode = _children[_currentState->getChildIndex()];
|
||||||
|
@ -195,13 +195,21 @@ void AnimRandomSwitch::switchRandomState(const AnimVariantMap& animVars, const A
|
||||||
}
|
}
|
||||||
_nextPoses = nextStateNode->evaluate(animVars, context, dt, triggers);
|
_nextPoses = nextStateNode->evaluate(animVars, context, dt, triggers);
|
||||||
} else if (_interpType == InterpType::SnapshotPrev) {
|
} else if (_interpType == InterpType::SnapshotPrev) {
|
||||||
// snapshot previoius pose
|
// snapshot previous pose
|
||||||
_prevPoses = _poses;
|
_prevPoses = _poses;
|
||||||
// no need to evaluate _nextPoses we will do it dynamically during the interp,
|
// no need to evaluate _nextPoses we will do it dynamically during the interp,
|
||||||
// however we need to set the current frame.
|
// however we need to set the current frame.
|
||||||
if (!desiredState->getResume()) {
|
if (!desiredState->getResume()) {
|
||||||
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
|
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
|
||||||
}
|
}
|
||||||
|
} else if (_interpType == InterpType::EvaluateBoth) {
|
||||||
|
// need to set current frame in destination branch.
|
||||||
|
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
|
||||||
|
if (interpActive) {
|
||||||
|
// snapshot previous pose
|
||||||
|
_prevPoses = _poses;
|
||||||
|
_interpType = InterpType::SnapshotPrev;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,6 +128,7 @@ void AnimStateMachine::switchState(const AnimVariantMap& animVars, const AnimCon
|
||||||
auto prevStateNode = _children[_currentState->getChildIndex()];
|
auto prevStateNode = _children[_currentState->getChildIndex()];
|
||||||
auto nextStateNode = _children[desiredState->getChildIndex()];
|
auto nextStateNode = _children[desiredState->getChildIndex()];
|
||||||
|
|
||||||
|
bool interpActive = _duringInterp;
|
||||||
_duringInterp = true;
|
_duringInterp = true;
|
||||||
_alpha = 0.0f;
|
_alpha = 0.0f;
|
||||||
float duration = std::max(0.001f, animVars.lookup(desiredState->_interpDurationVar, desiredState->_interpDuration));
|
float duration = std::max(0.001f, animVars.lookup(desiredState->_interpDurationVar, desiredState->_interpDuration));
|
||||||
|
@ -146,11 +147,19 @@ void AnimStateMachine::switchState(const AnimVariantMap& animVars, const AnimCon
|
||||||
nextStateNode->setCurrentFrame(desiredState->_interpTarget);
|
nextStateNode->setCurrentFrame(desiredState->_interpTarget);
|
||||||
_nextPoses = nextStateNode->evaluate(animVars, context, dt, triggers);
|
_nextPoses = nextStateNode->evaluate(animVars, context, dt, triggers);
|
||||||
} else if (_interpType == InterpType::SnapshotPrev) {
|
} else if (_interpType == InterpType::SnapshotPrev) {
|
||||||
// snapshot previoius pose
|
// snapshot previous pose
|
||||||
_prevPoses = _poses;
|
_prevPoses = _poses;
|
||||||
// no need to evaluate _nextPoses we will do it dynamically during the interp,
|
// no need to evaluate _nextPoses we will do it dynamically during the interp,
|
||||||
// however we need to set the current frame.
|
// however we need to set the current frame.
|
||||||
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
|
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
|
||||||
|
} else if (_interpType == InterpType::EvaluateBoth) {
|
||||||
|
// need to set current frame in destination branch.
|
||||||
|
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
|
||||||
|
if (interpActive) {
|
||||||
|
// snapshot previous pose
|
||||||
|
_prevPoses = _poses;
|
||||||
|
_interpType = InterpType::SnapshotPrev;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2112,8 +2112,10 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo
|
||||||
}
|
}
|
||||||
float easeOutInValue = _talkIdleInterpTime < 0.5f ? 4.0f * powf(_talkIdleInterpTime, 3.0f) : 4.0f * powf((_talkIdleInterpTime - 1.0f), 3.0f) + 1.0f;
|
float easeOutInValue = _talkIdleInterpTime < 0.5f ? 4.0f * powf(_talkIdleInterpTime, 3.0f) : 4.0f * powf((_talkIdleInterpTime - 1.0f), 3.0f) + 1.0f;
|
||||||
_animVars.set("talkOverlayAlpha", easeOutInValue);
|
_animVars.set("talkOverlayAlpha", easeOutInValue);
|
||||||
|
_animVars.set("idleOverlayAlpha", easeOutInValue); // backward compatibility for older anim graphs.
|
||||||
} else {
|
} else {
|
||||||
_animVars.set("talkOverlayAlpha", 1.0f);
|
_animVars.set("talkOverlayAlpha", 1.0f);
|
||||||
|
_animVars.set("idleOverlayAlpha", 1.0f); // backward compatibility for older anim graphs.
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_talkIdleInterpTime < 1.0f) {
|
if (_talkIdleInterpTime < 1.0f) {
|
||||||
|
@ -2124,8 +2126,10 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo
|
||||||
float easeOutInValue = _talkIdleInterpTime < 0.5f ? 4.0f * powf(_talkIdleInterpTime, 3.0f) : 4.0f * powf((_talkIdleInterpTime - 1.0f), 3.0f) + 1.0f;
|
float easeOutInValue = _talkIdleInterpTime < 0.5f ? 4.0f * powf(_talkIdleInterpTime, 3.0f) : 4.0f * powf((_talkIdleInterpTime - 1.0f), 3.0f) + 1.0f;
|
||||||
float talkAlpha = 1.0f - easeOutInValue;
|
float talkAlpha = 1.0f - easeOutInValue;
|
||||||
_animVars.set("talkOverlayAlpha", talkAlpha);
|
_animVars.set("talkOverlayAlpha", talkAlpha);
|
||||||
|
_animVars.set("idleOverlayAlpha", talkAlpha); // backward compatibility for older anim graphs.
|
||||||
} else {
|
} else {
|
||||||
_animVars.set("talkOverlayAlpha", 0.0f);
|
_animVars.set("talkOverlayAlpha", 0.0f);
|
||||||
|
_animVars.set("idleOverlayAlpha", 0.0f); // backward compatibility for older anim graphs.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue