mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 01:03:38 +02:00
increase hand restoration rate, improve function name clarity
This commit is contained in:
parent
2797d0ab3b
commit
2c6c57eec2
3 changed files with 7 additions and 8 deletions
|
@ -109,7 +109,7 @@ void MyAvatar::reset() {
|
|||
void MyAvatar::update(float deltaTime) {
|
||||
Head* head = getHead();
|
||||
head->relaxLean(deltaTime);
|
||||
updateFromGyros(deltaTime);
|
||||
updateFromFaceTracker(deltaTime);
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::MoveWithLean)) {
|
||||
// Faceshift drive is enabled, set the avatar drive based on the head position
|
||||
moveWithLean();
|
||||
|
@ -239,7 +239,7 @@ void MyAvatar::simulate(float deltaTime) {
|
|||
}
|
||||
|
||||
// Update avatar head rotation with sensor data
|
||||
void MyAvatar::updateFromGyros(float deltaTime) {
|
||||
void MyAvatar::updateFromFaceTracker(float deltaTime) {
|
||||
glm::vec3 estimatedPosition, estimatedRotation;
|
||||
|
||||
FaceTracker* tracker = Application::getInstance()->getActiveFaceTracker();
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
void reset();
|
||||
void update(float deltaTime);
|
||||
void simulate(float deltaTime);
|
||||
void updateFromGyros(float deltaTime);
|
||||
void updateFromFaceTracker(float deltaTime);
|
||||
void moveWithLean();
|
||||
|
||||
void render(const glm::vec3& cameraPosition, RenderMode renderMode = NORMAL_RENDER_MODE);
|
||||
|
|
|
@ -38,24 +38,23 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
|
|||
Hand* hand = _owningAvatar->getHand();
|
||||
hand->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
|
||||
|
||||
const float HAND_RESTORATION_PERIOD = 1.f; // seconds
|
||||
float handRestorePercent = glm::clamp(deltaTime / HAND_RESTORATION_PERIOD, 0.f, 1.f);
|
||||
const float HAND_RESTORATION_RATE = 0.25f;
|
||||
|
||||
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
||||
if (leftPalmIndex == -1) {
|
||||
// no Leap data; set hands from mouse
|
||||
if (_owningAvatar->getHandState() == HAND_STATE_NULL) {
|
||||
restoreRightHandPosition(handRestorePercent);
|
||||
restoreRightHandPosition(HAND_RESTORATION_RATE);
|
||||
} else {
|
||||
applyHandPosition(geometry.rightHandJointIndex, _owningAvatar->getHandPosition());
|
||||
}
|
||||
restoreLeftHandPosition(handRestorePercent);
|
||||
restoreLeftHandPosition(HAND_RESTORATION_RATE);
|
||||
|
||||
} else if (leftPalmIndex == rightPalmIndex) {
|
||||
// right hand only
|
||||
applyPalmData(geometry.rightHandJointIndex, geometry.rightFingerJointIndices, geometry.rightFingertipJointIndices,
|
||||
hand->getPalms()[leftPalmIndex]);
|
||||
restoreLeftHandPosition(handRestorePercent);
|
||||
restoreLeftHandPosition(HAND_RESTORATION_RATE);
|
||||
|
||||
} else {
|
||||
applyPalmData(geometry.leftHandJointIndex, geometry.leftFingerJointIndices, geometry.leftFingertipJointIndices,
|
||||
|
|
Loading…
Reference in a new issue