Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 9 files). Show all
Unified · Split
| @@ -401,7 +401,7 @@ bool SkeletonModel::getNeckParentRotationFromDefaultOrientation(glm::quat& neckP · 400 unmodified lines | |||
| 401 | glm::quat worldFrameRotation; | 401 | glm::quat worldFrameRotation; |
| 402 | bool success = getJointRotationInWorldFrame(parentIndex, worldFrameRotation); | 402 | bool success = getJointRotationInWorldFrame(parentIndex, worldFrameRotation); |
| 403 | if (success) { | 403 | if (success) { |
| 404 | neckParentRotation = worldFrameRotation * _rig->getJointState(parentIndex).getFBXJoint().inverseDefaultRotation; | 404 | neckParentRotation = worldFrameRotation * _rig->getJointState(parentIndex).getInverseDefaultRotation(); |
| 405 | } | 405 | } |
| 406 | return success; | 406 | return success; |
| 407 | } | 407 | } |
| @@ -477,18 +477,17 @@ void SkeletonModel::computeBoundingShape(const FBXGeometry& geometry) { · 69 unmodified lines | |||
| 477 | for (int i = 0; i < numStates; i++) { | 477 | for (int i = 0; i < numStates; i++) { |
| 478 | // compute the default transform of this joint | 478 | // compute the default transform of this joint |
| 479 | const JointState& state = _rig->getJointState(i); | 479 | const JointState& state = _rig->getJointState(i); |
| 480 | const FBXJoint& joint = state.getFBXJoint(); | 480 | int parentIndex = state.getParentIndex(); |
| 481 | int parentIndex = joint.parentIndex; | ||
| 482 | if (parentIndex == -1) { | 481 | if (parentIndex == -1) { |
| 483 | transforms[i] = _rig->getJointTransform(i); | 482 | transforms[i] = _rig->getJointTransform(i); |
| 484 | } else { | 483 | } else { |
| 485 | glm::quat modifiedRotation = joint.preRotation * joint.rotation * joint.postRotation; | 484 | glm::quat modifiedRotation = state.getPreRotation() * state.getOriginalRotation() * state.getPostRotation(); |
| 486 | transforms[i] = transforms[parentIndex] * glm::translate(joint.translation) | 485 | transforms[i] = transforms[parentIndex] * glm::translate(state.getTranslation()) |
| 487 | * joint.preTransform * glm::mat4_cast(modifiedRotation) * joint.postTransform; | 486 | * state.getPreTransform() * glm::mat4_cast(modifiedRotation) * state.getPostTransform(); |
| 488 | } | 487 | } |
| 489 | 488 | ||
| 490 | // Each joint contributes a sphere at its position | 489 | // Each joint contributes a sphere at its position |
| 491 | glm::vec3 axis(joint.boneRadius); | 490 | glm::vec3 axis(state.getBoneRadius()); |
| 492 | glm::vec3 jointPosition = extractTranslation(transforms[i]); | 491 | glm::vec3 jointPosition = extractTranslation(transforms[i]); |
| 493 | totalExtents.addPoint(jointPosition + axis); | 492 | totalExtents.addPoint(jointPosition + axis); |
| 494 | totalExtents.addPoint(jointPosition - axis); | 493 | totalExtents.addPoint(jointPosition - axis); |