mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-16 12:00:11 +02:00
Merge pull request #5834 from AndrewMeadows/ik-repairs-001
route hand data directly to new anim system
This commit is contained in:
commit
493819c013
1 changed files with 21 additions and 10 deletions
|
@ -735,19 +735,12 @@ void Rig::inverseKinematics(int endIndex, glm::vec3 targetPosition, const glm::q
|
|||
return;
|
||||
}
|
||||
|
||||
if (freeLineage.isEmpty()) {
|
||||
if (_enableAnimGraph && _animSkeleton) {
|
||||
// the hand data goes through a different path: Rig::updateFromHandParameters() --> early-exit
|
||||
return;
|
||||
}
|
||||
int numFree = freeLineage.size();
|
||||
|
||||
if (_enableAnimGraph && _animSkeleton) {
|
||||
if (endIndex == _leftHandJointIndex) {
|
||||
_animVars.set("leftHandPosition", targetPosition);
|
||||
_animVars.set("leftHandRotation", targetRotation);
|
||||
} else if (endIndex == _rightHandJointIndex) {
|
||||
_animVars.set("rightHandPosition", targetPosition);
|
||||
_animVars.set("rightHandRotation", targetRotation);
|
||||
}
|
||||
if (freeLineage.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -766,6 +759,7 @@ void Rig::inverseKinematics(int endIndex, glm::vec3 targetPosition, const glm::q
|
|||
|
||||
// relax toward default rotation
|
||||
// NOTE: ideally this should use dt and a relaxation timescale to compute how much to relax
|
||||
int numFree = freeLineage.size();
|
||||
for (int j = 0; j < numFree; j++) {
|
||||
int nextIndex = freeLineage.at(j);
|
||||
JointState& nextState = _jointStates[nextIndex];
|
||||
|
@ -1046,6 +1040,23 @@ void Rig::updateFromHandParameters(const HandParameters& params, float dt) {
|
|||
|
||||
if (_enableAnimGraph && _animSkeleton) {
|
||||
|
||||
// TODO: figure out how to obtain the yFlip from where it is actually stored
|
||||
glm::quat yFlipHACK = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
if (params.isLeftEnabled) {
|
||||
_animVars.set("leftHandPosition", yFlipHACK * params.leftPosition);
|
||||
_animVars.set("leftHandRotation", yFlipHACK * params.leftOrientation);
|
||||
} else {
|
||||
_animVars.unset("leftHandPosition");
|
||||
_animVars.unset("leftHandRotation");
|
||||
}
|
||||
if (params.isRightEnabled) {
|
||||
_animVars.set("rightHandPosition", yFlipHACK * params.rightPosition);
|
||||
_animVars.set("rightHandRotation", yFlipHACK * params.rightOrientation);
|
||||
} else {
|
||||
_animVars.unset("rightHandPosition");
|
||||
_animVars.unset("rightHandRotation");
|
||||
}
|
||||
|
||||
// set leftHand grab vars
|
||||
_animVars.set("isLeftHandIdle", false);
|
||||
_animVars.set("isLeftHandPoint", false);
|
||||
|
|
Loading…
Reference in a new issue