mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 01:00:44 +02:00
Compute the model offset in the rig, using the bind pose of the hips.
This commit is contained in:
parent
fa864d29f9
commit
a1b54945d6
3 changed files with 14 additions and 0 deletions
|
@ -246,6 +246,9 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
|
||||||
Hand* hand = _owningAvatar->getHand();
|
Hand* hand = _owningAvatar->getHand();
|
||||||
hand->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
|
hand->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
|
||||||
|
|
||||||
|
// let rig compute the model offset
|
||||||
|
setOffset(_rig->getModelOffset());
|
||||||
|
|
||||||
// Don't Relax toward hand positions when in animGraph mode.
|
// Don't Relax toward hand positions when in animGraph mode.
|
||||||
if (!_rig->getEnableAnimGraph()) {
|
if (!_rig->getEnableAnimGraph()) {
|
||||||
const float HAND_RESTORATION_RATE = 0.25f;
|
const float HAND_RESTORATION_RATE = 0.25f;
|
||||||
|
|
|
@ -1263,3 +1263,12 @@ void Rig::initAnimGraph(const QUrl& url, const FBXGeometry& fbxGeometry) {
|
||||||
qCCritical(animation) << "Error loading" << url.toDisplayString() << "code = " << error << "str =" << str;
|
qCCritical(animation) << "Error loading" << url.toDisplayString() << "code = " << error << "str =" << str;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 Rig::getModelOffset() const {
|
||||||
|
if (_animSkeleton && _rootJointIndex >= 0) {
|
||||||
|
return -_animSkeleton->getAbsoluteBindPose(_rootJointIndex).trans;
|
||||||
|
} else {
|
||||||
|
const glm::vec3 DEFAULT_MODEL_OFFSET(0.0f, 0.0f, 0.0f);
|
||||||
|
return DEFAULT_MODEL_OFFSET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -204,6 +204,8 @@ public:
|
||||||
AnimSkeleton::ConstPointer getAnimSkeleton() const { return _animSkeleton; }
|
AnimSkeleton::ConstPointer getAnimSkeleton() const { return _animSkeleton; }
|
||||||
bool disableHands {false}; // should go away with rig animation (and Rig::inverseKinematics)
|
bool disableHands {false}; // should go away with rig animation (and Rig::inverseKinematics)
|
||||||
|
|
||||||
|
glm::vec3 getModelOffset() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void updateLeanJoint(int index, float leanSideways, float leanForward, float torsoTwist);
|
void updateLeanJoint(int index, float leanSideways, float leanForward, float torsoTwist);
|
||||||
|
|
Loading…
Reference in a new issue