mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Adjust palm collision size, use last free index when ignoring.
This commit is contained in:
parent
9ecef89c6c
commit
02cd97deb1
3 changed files with 9 additions and 2 deletions
|
@ -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() {
|
void Hand::updateCollisions() {
|
||||||
// use position to obtain the left and right palm indices
|
// use position to obtain the left and right palm indices
|
||||||
|
@ -168,7 +168,7 @@ void Hand::updateCollisions() {
|
||||||
// and the current avatar
|
// and the current avatar
|
||||||
glm::vec3 owningPenetration;
|
glm::vec3 owningPenetration;
|
||||||
const Model& skeletonModel = _owningAvatar->getSkeletonModel();
|
const Model& skeletonModel = _owningAvatar->getSkeletonModel();
|
||||||
int skipIndex = skeletonModel.getParentJointIndex(
|
int skipIndex = skeletonModel.getLastFreeJointIndex(
|
||||||
(i == leftPalmIndex) ? skeletonModel.getLeftHandJointIndex() :
|
(i == leftPalmIndex) ? skeletonModel.getLeftHandJointIndex() :
|
||||||
(i == rightPalmIndex) ? skeletonModel.getRightHandJointIndex() : -1);
|
(i == rightPalmIndex) ? skeletonModel.getRightHandJointIndex() : -1);
|
||||||
if (_owningAvatar->findSpherePenetration(palm.getPosition(), scaledPalmRadius, owningPenetration, skipIndex)) {
|
if (_owningAvatar->findSpherePenetration(palm.getPosition(), scaledPalmRadius, owningPenetration, skipIndex)) {
|
||||||
|
|
|
@ -458,6 +458,10 @@ int Model::getParentJointIndex(int jointIndex) const {
|
||||||
return (isActive() && jointIndex != -1) ? _geometry->getFBXGeometry().joints.at(jointIndex).parentIndex : -1;
|
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 {
|
bool Model::getHeadPosition(glm::vec3& headPosition) const {
|
||||||
return isActive() && getJointPosition(_geometry->getFBXGeometry().headJointIndex, headPosition);
|
return isActive() && getJointPosition(_geometry->getFBXGeometry().headJointIndex, headPosition);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,9 @@ public:
|
||||||
/// Returns the index of the parent of the indexed joint, or -1 if not found.
|
/// Returns the index of the parent of the indexed joint, or -1 if not found.
|
||||||
int getParentJointIndex(int jointIndex) const;
|
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.
|
/// Returns the position of the head joint.
|
||||||
/// \return whether or not the head was found
|
/// \return whether or not the head was found
|
||||||
bool getHeadPosition(glm::vec3& headPosition) const;
|
bool getHeadPosition(glm::vec3& headPosition) const;
|
||||||
|
|
Loading…
Reference in a new issue