mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 11:48:52 +02:00
Making arm restoration rate independent of FPS and easier to tune.
This commit is contained in:
parent
9523ea7d03
commit
312bc7521f
1 changed files with 5 additions and 4 deletions
|
@ -36,23 +36,24 @@ void SkeletonModel::simulate(float deltaTime) {
|
||||||
HandData& hand = _owningAvatar->getHand();
|
HandData& hand = _owningAvatar->getHand();
|
||||||
hand.getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
|
hand.getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
|
||||||
|
|
||||||
const float HAND_RESTORATION_RATE = 0.25f;
|
const float HAND_RESTORATION_PERIOD = 1.f; // seconds
|
||||||
|
float handRestorePercent = glm::clamp(deltaTime / HAND_RESTORATION_PERIOD, 0.f, 1.f);
|
||||||
|
|
||||||
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
||||||
if (leftPalmIndex == -1) {
|
if (leftPalmIndex == -1) {
|
||||||
// no Leap data; set hands from mouse
|
// no Leap data; set hands from mouse
|
||||||
if (_owningAvatar->getHandState() == HAND_STATE_NULL) {
|
if (_owningAvatar->getHandState() == HAND_STATE_NULL) {
|
||||||
restoreRightHandPosition(HAND_RESTORATION_RATE);
|
restoreRightHandPosition(handRestorePercent);
|
||||||
} else {
|
} else {
|
||||||
applyHandPosition(geometry.rightHandJointIndex, _owningAvatar->getHandPosition());
|
applyHandPosition(geometry.rightHandJointIndex, _owningAvatar->getHandPosition());
|
||||||
}
|
}
|
||||||
restoreLeftHandPosition(HAND_RESTORATION_RATE);
|
restoreLeftHandPosition(handRestorePercent);
|
||||||
|
|
||||||
} else if (leftPalmIndex == rightPalmIndex) {
|
} else if (leftPalmIndex == rightPalmIndex) {
|
||||||
// right hand only
|
// right hand only
|
||||||
applyPalmData(geometry.rightHandJointIndex, geometry.rightFingerJointIndices, geometry.rightFingertipJointIndices,
|
applyPalmData(geometry.rightHandJointIndex, geometry.rightFingerJointIndices, geometry.rightFingertipJointIndices,
|
||||||
hand.getPalms()[leftPalmIndex]);
|
hand.getPalms()[leftPalmIndex]);
|
||||||
restoreLeftHandPosition(HAND_RESTORATION_RATE);
|
restoreLeftHandPosition(handRestorePercent);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
applyPalmData(geometry.leftHandJointIndex, geometry.leftFingerJointIndices, geometry.leftFingertipJointIndices,
|
applyPalmData(geometry.leftHandJointIndex, geometry.leftFingerJointIndices, geometry.leftFingertipJointIndices,
|
||||||
|
|
Loading…
Reference in a new issue