mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 16:36:54 +02:00
Merge pull request #6990 from howard-stearns/better-head-joint-setup
Better head joint setup
This commit is contained in:
commit
17851dd129
1 changed files with 14 additions and 14 deletions
|
@ -46,21 +46,21 @@ void SkeletonModel::initJointStates() {
|
||||||
|
|
||||||
// Determine the default eye position for avatar scale = 1.0
|
// Determine the default eye position for avatar scale = 1.0
|
||||||
int headJointIndex = _geometry->getFBXGeometry().headJointIndex;
|
int headJointIndex = _geometry->getFBXGeometry().headJointIndex;
|
||||||
if (0 <= headJointIndex && headJointIndex < _rig->getJointStateCount()) {
|
if (0 > headJointIndex || headJointIndex >= _rig->getJointStateCount()) {
|
||||||
|
qCWarning(interfaceapp) << "Bad head joint! Got:" << headJointIndex << "jointCount:" << _rig->getJointStateCount();
|
||||||
glm::vec3 leftEyePosition, rightEyePosition;
|
|
||||||
getEyeModelPositions(leftEyePosition, rightEyePosition);
|
|
||||||
glm::vec3 midEyePosition = (leftEyePosition + rightEyePosition) / 2.0f;
|
|
||||||
|
|
||||||
int rootJointIndex = _geometry->getFBXGeometry().rootJointIndex;
|
|
||||||
glm::vec3 rootModelPosition;
|
|
||||||
getJointPosition(rootJointIndex, rootModelPosition);
|
|
||||||
|
|
||||||
_defaultEyeModelPosition = midEyePosition - rootModelPosition;
|
|
||||||
|
|
||||||
// Skeleton may have already been scaled so unscale it
|
|
||||||
_defaultEyeModelPosition = _defaultEyeModelPosition / _scale;
|
|
||||||
}
|
}
|
||||||
|
glm::vec3 leftEyePosition, rightEyePosition;
|
||||||
|
getEyeModelPositions(leftEyePosition, rightEyePosition);
|
||||||
|
glm::vec3 midEyePosition = (leftEyePosition + rightEyePosition) / 2.0f;
|
||||||
|
|
||||||
|
int rootJointIndex = _geometry->getFBXGeometry().rootJointIndex;
|
||||||
|
glm::vec3 rootModelPosition;
|
||||||
|
getJointPosition(rootJointIndex, rootModelPosition);
|
||||||
|
|
||||||
|
_defaultEyeModelPosition = midEyePosition - rootModelPosition;
|
||||||
|
|
||||||
|
// Skeleton may have already been scaled so unscale it
|
||||||
|
_defaultEyeModelPosition = _defaultEyeModelPosition / _scale;
|
||||||
|
|
||||||
computeBoundingShape();
|
computeBoundingShape();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue