mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 07:34:02 +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);
|
||||
|
||||
// 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.
|
||||
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) {
|
||||
return -_animSkeleton->getAbsoluteBindPose(_rootJointIndex).trans;
|
||||
modelOffsetOut = -_animSkeleton->getAbsoluteBindPose(_rootJointIndex).trans;
|
||||
return true;
|
||||
} else {
|
||||
const glm::vec3 DEFAULT_MODEL_OFFSET(0.0f, 0.0f, 0.0f);
|
||||
return DEFAULT_MODEL_OFFSET;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ public:
|
|||
AnimSkeleton::ConstPointer getAnimSkeleton() const { return _animSkeleton; }
|
||||
bool disableHands {false}; // should go away with rig animation (and Rig::inverseKinematics)
|
||||
|
||||
glm::vec3 getModelOffset() const;
|
||||
bool getModelOffset(glm::vec3& modelOffsetOut) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
Loading…
Reference in a new issue