History

fix avatar bounding capsule calculations

Andrew Meadows committed 11 years ago

Commit 281e4f21 parent 90fe54e6 files · +99 −109Browse files

Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 6 files). Show all

Unified · Split

interface/src/avatar/SkeletonModel.cpp+12−6
@@ -544,14 +544,20 @@ void SkeletonModel::computeBoundingShape() { · 543 unmodified lines
544 totalExtents.addPoint(glm::vec3(0.0f));544 totalExtents.addPoint(glm::vec3(0.0f));
545 int numStates = _rig->getJointStateCount();545 int numStates = _rig->getJointStateCount();
546 for (int i = 0; i < numStates; i++) {546 for (int i = 0; i < numStates; i++) {
547 // compute the default transform of this joint
548 const JointState& state = _rig->getJointState(i);547 const JointState& state = _rig->getJointState(i);
549 548
550 // Each joint contributes a sphere at its position549 const glm::mat4& jointTransform = state.getTransform();
551 glm::vec3 axis(state.getBoneRadius());550 float scale = extractUniformScale(jointTransform);
552 glm::vec3 jointPosition = state.getPosition();551
553 totalExtents.addPoint(jointPosition + axis);552 // Each joint contributes a capsule defined by FBXJoint.shapeInfo.
554 totalExtents.addPoint(jointPosition - axis);553 // For totalExtents we use the capsule endpoints expanded by the radius.
554 const FBXJointShapeInfo& shapeInfo = geometry.joints.at(i).shapeInfo;
555 for (int j = 0; j < shapeInfo.points.size(); ++j) {
556 glm::vec3 transformedPoint = extractTranslation(jointTransform * glm::translate(shapeInfo.points[j]));
557 vec3 radius(scale * shapeInfo.radius);
558 totalExtents.addPoint(transformedPoint + radius);
559 totalExtents.addPoint(transformedPoint - radius);
560 }
555 }561 }
556 562
557 // compute bounding shape parameters563 // compute bounding shape parameters

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t