mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
Merge pull request #8299 from hyperlogic/bug-fix/no-hips-no-problem
Prevent avatars with missing "Hips" joints from causing crashes
This commit is contained in:
commit
f0574282eb
1 changed files with 6 additions and 2 deletions
|
@ -428,7 +428,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars
|
|||
// shift hips according to the _hipsOffset from the previous frame
|
||||
float offsetLength = glm::length(_hipsOffset);
|
||||
const float MIN_HIPS_OFFSET_LENGTH = 0.03f;
|
||||
if (offsetLength > MIN_HIPS_OFFSET_LENGTH) {
|
||||
if (offsetLength > MIN_HIPS_OFFSET_LENGTH && _hipsIndex >= 0) {
|
||||
// but only if offset is long enough
|
||||
float scaleFactor = ((offsetLength - MIN_HIPS_OFFSET_LENGTH) / offsetLength);
|
||||
if (_hipsParentIndex == -1) {
|
||||
|
@ -861,7 +861,11 @@ void AnimInverseKinematics::setSkeletonInternal(AnimSkeleton::ConstPointer skele
|
|||
_hipsIndex = _skeleton->nameToJointIndex("Hips");
|
||||
|
||||
// also cache the _hipsParentIndex for later
|
||||
_hipsParentIndex = _skeleton->getParentIndex(_hipsIndex);
|
||||
if (_hipsIndex >= 0) {
|
||||
_hipsParentIndex = _skeleton->getParentIndex(_hipsIndex);
|
||||
} else {
|
||||
_hipsParentIndex = -1;
|
||||
}
|
||||
} else {
|
||||
clearConstraints();
|
||||
_headIndex = -1;
|
||||
|
|
Loading…
Reference in a new issue