mirror of
https://github.com/overte-org/overte.git
synced 2025-07-17 14:37:35 +02:00
Fix for model offset when using Rig Animations.
This commit is contained in:
parent
fc7b6dee84
commit
c0be32d359
3 changed files with 9 additions and 6 deletions
|
@ -247,7 +247,10 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
|
||||||
hand->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
|
hand->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
|
||||||
|
|
||||||
// let rig compute the model offset
|
// let rig compute the model offset
|
||||||
setOffset(_rig->getModelOffset());
|
glm::vec3 modelOffset;
|
||||||
|
if (_rig->getModelOffset(modelOffset)) {
|
||||||
|
setOffset(modelOffset);
|
||||||
|
}
|
||||||
|
|
||||||
// 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()) {
|
||||||
|
|
|
@ -1203,11 +1203,11 @@ void Rig::initAnimGraph(const QUrl& url, const FBXGeometry& fbxGeometry) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 Rig::getModelOffset() const {
|
bool Rig::getModelOffset(glm::vec3& modelOffsetOut) const {
|
||||||
if (_animSkeleton && _rootJointIndex >= 0) {
|
if (_animSkeleton && _rootJointIndex >= 0) {
|
||||||
return -_animSkeleton->getAbsoluteBindPose(_rootJointIndex).trans;
|
modelOffsetOut = -_animSkeleton->getAbsoluteBindPose(_rootJointIndex).trans;
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
const glm::vec3 DEFAULT_MODEL_OFFSET(0.0f, 0.0f, 0.0f);
|
return false;
|
||||||
return DEFAULT_MODEL_OFFSET;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ 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;
|
bool getModelOffset(glm::vec3& modelOffsetOut) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue