Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 3 files). Show all
Unified · Split
| @@ -236,20 +236,15 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) { · 235 unmodified lines | |||
| 236 | 236 | ||
| 237 | const FBXGeometry& geometry = _geometry->getFBXGeometry(); | 237 | const FBXGeometry& geometry = _geometry->getFBXGeometry(); |
| 238 | 238 | ||
| 239 | // find the left and rightmost active palms | ||
| 240 | int leftPalmIndex, rightPalmIndex; | ||
| 241 | Hand* hand = _owningAvatar->getHand(); | ||
| 242 | |||
| 243 | // FIXME - it's possible that the left/right hand indices could change between this call | ||
| 244 | // and the call to hand->getCopyOfPalms(); This logic should be reworked to only operate on | ||
| 245 | // the copy of the palms data | ||
| 246 | hand->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex); | ||
| 247 | |||
| 248 | // Don't Relax toward hand positions when in animGraph mode. | 239 | // Don't Relax toward hand positions when in animGraph mode. |
| 249 | if (!_rig->getEnableAnimGraph()) { | 240 | if (!_rig->getEnableAnimGraph()) { |
| 250 | auto palms = hand->getCopyOfPalms(); | 241 | |
| 242 | Hand* hand = _owningAvatar->getHand(); | ||
| 243 | auto leftPalm = hand->getCopyOfPalmData(HandData::LeftHand); | ||
| 244 | auto rightPalm = hand->getCopyOfPalmData(HandData::RightHand); | ||
| 245 | |||
| 251 | const float HAND_RESTORATION_RATE = 0.25f; | 246 | const float HAND_RESTORATION_RATE = 0.25f; |
| 252 | if (leftPalmIndex == -1 && rightPalmIndex == -1) { | 247 | if (!leftPalm.isActive() && !rightPalm.isActive()) { |
| 253 | // palms are not yet set, use mouse | 248 | // palms are not yet set, use mouse |
| 254 | if (_owningAvatar->getHandState() == HAND_STATE_NULL) { | 249 | if (_owningAvatar->getHandState() == HAND_STATE_NULL) { |
| 255 | restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); | 250 | restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); |
| @@ -259,20 +254,14 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) { · 3 unmodified lines | |||
| 259 | applyHandPosition(geometry.rightHandJointIndex, handPosition); | 254 | applyHandPosition(geometry.rightHandJointIndex, handPosition); |
| 260 | } | 255 | } |
| 261 | restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); | 256 | restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); |
| 262 | |||
| 263 | } else if (leftPalmIndex == rightPalmIndex) { | ||
| 264 | // right hand only | ||
| 265 | applyPalmData(geometry.rightHandJointIndex, palms[leftPalmIndex]); | ||
| 266 | restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); | ||
| 267 | |||
| 268 | } else { | 257 | } else { |
| 269 | if (leftPalmIndex != -1) { | 258 | if (leftPalm.isActive()) { |
| 270 | applyPalmData(geometry.leftHandJointIndex, palms[leftPalmIndex]); | 259 | applyPalmData(geometry.leftHandJointIndex, leftPalm); |
| 271 | } else { | 260 | } else { |
| 272 | restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); | 261 | restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); |
| 273 | } | 262 | } |
| 274 | if (rightPalmIndex != -1) { | 263 | if (rightPalm.isActive()) { |
| 275 | applyPalmData(geometry.rightHandJointIndex, palms[rightPalmIndex]); | 264 | applyPalmData(geometry.rightHandJointIndex, rightPalm); |
| 276 | } else { | 265 | } else { |
| 277 | restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); | 266 | restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); |
| 278 | } | 267 | } |