mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 02:31:13 +02:00
a little more cleanup
This commit is contained in:
parent
7f313e7f86
commit
65eae35433
3 changed files with 10 additions and 42 deletions
|
@ -236,20 +236,15 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
|
||||||
|
|
||||||
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
||||||
|
|
||||||
// find the left and rightmost active palms
|
|
||||||
int leftPalmIndex, rightPalmIndex;
|
|
||||||
Hand* hand = _owningAvatar->getHand();
|
|
||||||
|
|
||||||
// FIXME - it's possible that the left/right hand indices could change between this call
|
|
||||||
// and the call to hand->getCopyOfPalms(); This logic should be reworked to only operate on
|
|
||||||
// the copy of the palms data
|
|
||||||
hand->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
|
|
||||||
|
|
||||||
// Don't Relax toward hand positions when in animGraph mode.
|
// Don't Relax toward hand positions when in animGraph mode.
|
||||||
if (!_rig->getEnableAnimGraph()) {
|
if (!_rig->getEnableAnimGraph()) {
|
||||||
auto palms = hand->getCopyOfPalms();
|
|
||||||
|
Hand* hand = _owningAvatar->getHand();
|
||||||
|
auto leftPalm = hand->getCopyOfPalmData(HandData::LeftHand);
|
||||||
|
auto rightPalm = hand->getCopyOfPalmData(HandData::RightHand);
|
||||||
|
|
||||||
const float HAND_RESTORATION_RATE = 0.25f;
|
const float HAND_RESTORATION_RATE = 0.25f;
|
||||||
if (leftPalmIndex == -1 && rightPalmIndex == -1) {
|
if (!leftPalm.isActive() && !rightPalm.isActive()) {
|
||||||
// palms are not yet set, use mouse
|
// palms are not yet set, use mouse
|
||||||
if (_owningAvatar->getHandState() == HAND_STATE_NULL) {
|
if (_owningAvatar->getHandState() == HAND_STATE_NULL) {
|
||||||
restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY);
|
restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY);
|
||||||
|
@ -259,20 +254,14 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
|
||||||
applyHandPosition(geometry.rightHandJointIndex, handPosition);
|
applyHandPosition(geometry.rightHandJointIndex, handPosition);
|
||||||
}
|
}
|
||||||
restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY);
|
restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY);
|
||||||
|
|
||||||
} else if (leftPalmIndex == rightPalmIndex) {
|
|
||||||
// right hand only
|
|
||||||
applyPalmData(geometry.rightHandJointIndex, palms[leftPalmIndex]);
|
|
||||||
restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (leftPalmIndex != -1) {
|
if (leftPalm.isActive()) {
|
||||||
applyPalmData(geometry.leftHandJointIndex, palms[leftPalmIndex]);
|
applyPalmData(geometry.leftHandJointIndex, leftPalm);
|
||||||
} else {
|
} else {
|
||||||
restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY);
|
restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY);
|
||||||
}
|
}
|
||||||
if (rightPalmIndex != -1) {
|
if (rightPalm.isActive()) {
|
||||||
applyPalmData(geometry.rightHandJointIndex, palms[rightPalmIndex]);
|
applyPalmData(geometry.rightHandJointIndex, rightPalm);
|
||||||
} else {
|
} else {
|
||||||
restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY);
|
restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,23 +48,6 @@ PalmData HandData::getCopyOfPalmData(Hand hand) const {
|
||||||
return PalmData(); // invalid hand
|
return PalmData(); // invalid hand
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandData::getLeftRightPalmIndices(int& leftPalmIndex, int& rightPalmIndex) const {
|
|
||||||
QReadLocker locker(&_palmsLock);
|
|
||||||
leftPalmIndex = -1;
|
|
||||||
rightPalmIndex = -1;
|
|
||||||
for (size_t i = 0; i < _palms.size(); i++) {
|
|
||||||
const PalmData& palm = _palms[i];
|
|
||||||
if (palm.isActive()) {
|
|
||||||
if (palm.whichHand() == LeftHand) {
|
|
||||||
leftPalmIndex = i;
|
|
||||||
}
|
|
||||||
if (palm.whichHand() == RightHand) {
|
|
||||||
rightPalmIndex = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PalmData::PalmData(HandData* owningHandData, HandData::Hand hand) :
|
PalmData::PalmData(HandData* owningHandData, HandData::Hand hand) :
|
||||||
_rawRotation(0.0f, 0.0f, 0.0f, 1.0f),
|
_rawRotation(0.0f, 0.0f, 0.0f, 1.0f),
|
||||||
_rawPosition(0.0f),
|
_rawPosition(0.0f),
|
||||||
|
|
|
@ -54,10 +54,6 @@ public:
|
||||||
|
|
||||||
std::vector<PalmData> getCopyOfPalms() const { QReadLocker locker(&_palmsLock); return _palms; }
|
std::vector<PalmData> getCopyOfPalms() const { QReadLocker locker(&_palmsLock); return _palms; }
|
||||||
|
|
||||||
/// Finds the indices of the left and right palms according to their locations, or -1 if either or
|
|
||||||
/// both is not found.
|
|
||||||
void getLeftRightPalmIndices(int& leftPalmIndex, int& rightPalmIndex) const;
|
|
||||||
|
|
||||||
/// Checks for penetration between the described sphere and the hand.
|
/// Checks for penetration between the described sphere and the hand.
|
||||||
/// \param penetratorCenter the center of the penetration test sphere
|
/// \param penetratorCenter the center of the penetration test sphere
|
||||||
/// \param penetratorRadius the radius of the penetration test sphere
|
/// \param penetratorRadius the radius of the penetration test sphere
|
||||||
|
|
Loading…
Reference in a new issue