mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-12 13:36:11 +02:00
Try smoothing the PrioVR input over a couple of frames.
This commit is contained in:
parent
f28ba72f75
commit
c12f436a7c
2 changed files with 7 additions and 1 deletions
|
@ -48,6 +48,7 @@ PrioVR::PrioVR() {
|
|||
return;
|
||||
}
|
||||
_jointRotations.resize(LIST_LENGTH);
|
||||
_lastJointRotations.resize(LIST_LENGTH);
|
||||
for (int i = 0; i < LIST_LENGTH; i++) {
|
||||
_humanIKJointIndices.append(jointsDiscovered[i] ? indexOfHumanIKJoint(JOINT_NAMES[i]) : -1);
|
||||
}
|
||||
|
@ -86,10 +87,14 @@ void PrioVR::update() {
|
|||
yei_getLastStreamDataAll(_skeletalDevice, (char*)_jointRotations.data(),
|
||||
_jointRotations.size() * sizeof(glm::quat), ×tamp);
|
||||
|
||||
// convert to our expected coordinate system
|
||||
// convert to our expected coordinate system, average with last rotations to smooth
|
||||
for (int i = 0; i < _jointRotations.size(); i++) {
|
||||
_jointRotations[i].y *= -1.0f;
|
||||
_jointRotations[i].z *= -1.0f;
|
||||
|
||||
glm::quat lastRotation = _lastRotations.at(i);
|
||||
_lastRotations[i] = _jointRotations.at(i);
|
||||
_jointRotations[i] = safeMix(lastRotation, _jointRotations.at(i), 0.5f);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ private:
|
|||
|
||||
QVector<int> _humanIKJointIndices;
|
||||
QVector<glm::quat> _jointRotations;
|
||||
QVector<glm::quat> _lastJointRotations;
|
||||
|
||||
QDateTime _calibrationCountdownStarted;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue