mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 16:41:02 +02:00
CR
This commit is contained in:
parent
38317a23c9
commit
e03368414e
2 changed files with 3 additions and 16 deletions
|
@ -489,7 +489,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars
|
||||||
// by looking for discrepancies between where a targeted endEffector is
|
// by looking for discrepancies between where a targeted endEffector is
|
||||||
// and where it wants to be (after IK solutions are done)
|
// and where it wants to be (after IK solutions are done)
|
||||||
|
|
||||||
// OUTOFBODY_HACK:use weighted average between HMD and other targets
|
// use weighted average between HMD and other targets
|
||||||
float HMD_WEIGHT = 10.0f;
|
float HMD_WEIGHT = 10.0f;
|
||||||
float OTHER_WEIGHT = 1.0f;
|
float OTHER_WEIGHT = 1.0f;
|
||||||
float totalWeight = 0.0f;
|
float totalWeight = 0.0f;
|
||||||
|
@ -542,7 +542,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars
|
||||||
float tau = dt < HIPS_OFFSET_SLAVE_TIMESCALE ? dt / HIPS_OFFSET_SLAVE_TIMESCALE : 1.0f;
|
float tau = dt < HIPS_OFFSET_SLAVE_TIMESCALE ? dt / HIPS_OFFSET_SLAVE_TIMESCALE : 1.0f;
|
||||||
_hipsOffset += additionalHipsOffset * tau;
|
_hipsOffset += additionalHipsOffset * tau;
|
||||||
|
|
||||||
// clamp the horizontal component of the hips offset
|
// clamp the hips offset
|
||||||
float hipsOffsetLength = glm::length(_hipsOffset);
|
float hipsOffsetLength = glm::length(_hipsOffset);
|
||||||
if (hipsOffsetLength > _maxHipsOffsetLength) {
|
if (hipsOffsetLength > _maxHipsOffsetLength) {
|
||||||
_hipsOffset *= _maxHipsOffsetLength / hipsOffsetLength;
|
_hipsOffset *= _maxHipsOffsetLength / hipsOffsetLength;
|
||||||
|
@ -555,7 +555,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimInverseKinematics::setMaxHipsOffsetLength(float maxLength) {
|
void AnimInverseKinematics::setMaxHipsOffsetLength(float maxLength) {
|
||||||
// OUTOFBODY_HACK: manually adjust scale here
|
// manually adjust scale here
|
||||||
const float METERS_TO_CENTIMETERS = 100.0f;
|
const float METERS_TO_CENTIMETERS = 100.0f;
|
||||||
_maxHipsOffsetLength = METERS_TO_CENTIMETERS * maxLength;
|
_maxHipsOffsetLength = METERS_TO_CENTIMETERS * maxLength;
|
||||||
}
|
}
|
||||||
|
@ -938,22 +938,10 @@ void AnimInverseKinematics::setSkeletonInternal(AnimSkeleton::ConstPointer skele
|
||||||
} else {
|
} else {
|
||||||
_hipsParentIndex = -1;
|
_hipsParentIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto currentJointIndex = _headIndex;
|
|
||||||
auto parentJointIndex = _skeleton->getParentIndex(currentJointIndex);
|
|
||||||
_spineLength = 0.0f;
|
|
||||||
while (currentJointIndex != _hipsIndex && parentJointIndex != -1) {
|
|
||||||
_spineLength += glm::distance(_skeleton->getAbsoluteDefaultPose(currentJointIndex).trans(),
|
|
||||||
_skeleton->getAbsoluteDefaultPose(parentJointIndex).trans());
|
|
||||||
|
|
||||||
currentJointIndex = parentJointIndex;
|
|
||||||
parentJointIndex = _skeleton->getParentIndex(currentJointIndex);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
clearConstraints();
|
clearConstraints();
|
||||||
_headIndex = -1;
|
_headIndex = -1;
|
||||||
_hipsIndex = -1;
|
_hipsIndex = -1;
|
||||||
_hipsParentIndex = -1;
|
_hipsParentIndex = -1;
|
||||||
_spineLength = 0.0f;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,6 @@ protected:
|
||||||
int _headIndex { -1 };
|
int _headIndex { -1 };
|
||||||
int _hipsIndex { -1 };
|
int _hipsIndex { -1 };
|
||||||
int _hipsParentIndex { -1 };
|
int _hipsParentIndex { -1 };
|
||||||
float _spineLength { 0.0f };
|
|
||||||
|
|
||||||
// _maxTargetIndex is tracked to help optimize the recalculation of absolute poses
|
// _maxTargetIndex is tracked to help optimize the recalculation of absolute poses
|
||||||
// during the the cyclic coordinate descent algorithm
|
// during the the cyclic coordinate descent algorithm
|
||||||
|
|
Loading…
Reference in a new issue