mirror of
https://github.com/overte-org/overte.git
synced 2025-08-16 12:51:28 +02:00
Skip the hands' parents as well as the hands themselves.
This commit is contained in:
parent
193f676fcb
commit
9b3560d414
3 changed files with 12 additions and 3 deletions
|
@ -165,9 +165,11 @@ void Hand::calculateGeometry() {
|
|||
}
|
||||
const float PALM_RADIUS = 0.01f;
|
||||
glm::vec3 penetration;
|
||||
int skipIndex = (i == leftPalmIndex) ? _owningAvatar->getSkeletonModel().getLeftHandJointIndex() :
|
||||
(i == rightPalmIndex) ? _owningAvatar->getSkeletonModel().getRightHandJointIndex() : -1;
|
||||
if (_owningAvatar->getSkeletonModel().findSpherePenetration(palm.getPosition(),
|
||||
const Model& skeletonModel = _owningAvatar->getSkeletonModel();
|
||||
int skipIndex = skeletonModel.getParentJointIndex(
|
||||
(i == leftPalmIndex) ? skeletonModel.getLeftHandJointIndex() :
|
||||
(i == rightPalmIndex) ? skeletonModel.getRightHandJointIndex() : -1);
|
||||
if (skeletonModel.findSpherePenetration(palm.getPosition(),
|
||||
PALM_RADIUS * _owningAvatar->getScale(), penetration, skipIndex)) {
|
||||
palm.addToPosition(-penetration);
|
||||
}
|
||||
|
|
|
@ -454,6 +454,10 @@ bool Model::render(float alpha) {
|
|||
return true;
|
||||
}
|
||||
|
||||
int Model::getParentJointIndex(int jointIndex) const {
|
||||
return (isActive() && jointIndex != -1) ? _geometry->getFBXGeometry().joints.at(jointIndex).parentIndex : -1;
|
||||
}
|
||||
|
||||
bool Model::getHeadPosition(glm::vec3& headPosition) const {
|
||||
return isActive() && getJointPosition(_geometry->getFBXGeometry().headJointIndex, headPosition);
|
||||
}
|
||||
|
|
|
@ -60,6 +60,9 @@ public:
|
|||
/// Returns the index of the right hand joint, or -1 if not found.
|
||||
int getRightHandJointIndex() const { return isActive() ? _geometry->getFBXGeometry().rightHandJointIndex : -1; }
|
||||
|
||||
/// Returns the index of the parent of the indexed joint, or -1 if not found.
|
||||
int getParentJointIndex(int jointIndex) const;
|
||||
|
||||
/// Returns the position of the head joint.
|
||||
/// \return whether or not the head was found
|
||||
bool getHeadPosition(glm::vec3& headPosition) const;
|
||||
|
|
Loading…
Reference in a new issue