mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 10:28:57 +02:00
Fix for flickering eyeballs
Calling glm::axis() on an identity quaternion does not result in a normalized vector. This vector was used within Rig::updateEyeJoint() to limit the rotation of the eye balls, to prevent the eyes from rolling back into the avatar's head. If the avatar was looking straight ahead, this could result in bad quaternions in the eye ball joint matrices, which in turn would cause the eye ball mesh or any mesh influenced by the eyeball joints not to render.
This commit is contained in:
parent
24ca5b3d60
commit
80dfed77d7
1 changed files with 3 additions and 1 deletions
|
@ -1056,7 +1056,9 @@ void Rig::updateEyeJoint(int index, const glm::vec3& modelTranslation, const glm
|
|||
|
||||
// limit rotation
|
||||
const float MAX_ANGLE = 30.0f * RADIANS_PER_DEGREE;
|
||||
deltaQuat = glm::angleAxis(glm::clamp(glm::angle(deltaQuat), -MAX_ANGLE, MAX_ANGLE), glm::axis(deltaQuat));
|
||||
if (fabsf(glm::angle(deltaQuat)) > MAX_ANGLE) {
|
||||
deltaQuat = glm::angleAxis(glm::clamp(glm::angle(deltaQuat), -MAX_ANGLE, MAX_ANGLE), glm::axis(deltaQuat));
|
||||
}
|
||||
|
||||
// directly set absolutePose rotation
|
||||
_internalPoseSet._absolutePoses[index].rot = deltaQuat * headQuat;
|
||||
|
|
Loading…
Reference in a new issue