mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 04:27:44 +02:00
Fix face-tracked head disappearing into body
Normalize quaternion to ensure that acos(r.w) is valid (r.w <= 1.0) and r.w = 1.0 when r.x = r.y = r.z = 0.0.
This commit is contained in:
parent
349886c146
commit
5050171d30
1 changed files with 1 additions and 1 deletions
|
@ -382,7 +382,7 @@ void DdeFaceTracker::decodePacket(const QByteArray& buffer) {
|
||||||
// Compute relative rotation
|
// Compute relative rotation
|
||||||
rotation = glm::inverse(_referenceRotation) * rotation;
|
rotation = glm::inverse(_referenceRotation) * rotation;
|
||||||
if (isFiltering) {
|
if (isFiltering) {
|
||||||
glm::quat r = rotation * glm::inverse(_headRotation);
|
glm::quat r = glm::normalize(rotation * glm::inverse(_headRotation));
|
||||||
float theta = 2 * acos(r.w);
|
float theta = 2 * acos(r.w);
|
||||||
glm::vec3 angularVelocity;
|
glm::vec3 angularVelocity;
|
||||||
if (theta > EPSILON) {
|
if (theta > EPSILON) {
|
||||||
|
|
Loading…
Reference in a new issue