Adjust palm collision size, use last free index when ignoring.

This commit is contained in:
Andrzej Kapolka 2013-12-05 16:28:33 -08:00
parent 9ecef89c6c
commit 02cd97deb1
3 changed files with 9 additions and 2 deletions

View file

@ -137,7 +137,7 @@ void Hand::simulate(float deltaTime, bool isMine) {
}
}
const float PALM_COLLISION_RADIUS = 0.01f;
const float PALM_COLLISION_RADIUS = 0.03f;
void Hand::updateCollisions() {
// use position to obtain the left and right palm indices
@ -168,7 +168,7 @@ void Hand::updateCollisions() {
// and the current avatar
glm::vec3 owningPenetration;
const Model& skeletonModel = _owningAvatar->getSkeletonModel();
int skipIndex = skeletonModel.getParentJointIndex(
int skipIndex = skeletonModel.getLastFreeJointIndex(
(i == leftPalmIndex) ? skeletonModel.getLeftHandJointIndex() :
(i == rightPalmIndex) ? skeletonModel.getRightHandJointIndex() : -1);
if (_owningAvatar->findSpherePenetration(palm.getPosition(), scaledPalmRadius, owningPenetration, skipIndex)) {

View file

@ -458,6 +458,10 @@ int Model::getParentJointIndex(int jointIndex) const {
return (isActive() && jointIndex != -1) ? _geometry->getFBXGeometry().joints.at(jointIndex).parentIndex : -1;
}
int Model::getLastFreeJointIndex(int jointIndex) const {
return (isActive() && jointIndex != -1) ? _geometry->getFBXGeometry().joints.at(jointIndex).freeLineage.last() : -1;
}
bool Model::getHeadPosition(glm::vec3& headPosition) const {
return isActive() && getJointPosition(_geometry->getFBXGeometry().headJointIndex, headPosition);
}

View file

@ -63,6 +63,9 @@ public:
/// Returns the index of the parent of the indexed joint, or -1 if not found.
int getParentJointIndex(int jointIndex) const;
/// Returns the index of the last free ancestor or the indexed joint, or -1 if not found.
int getLastFreeJointIndex(int jointIndex) const;
/// Returns the position of the head joint.
/// \return whether or not the head was found
bool getHeadPosition(glm::vec3& headPosition) const;