mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 03:57:17 +02:00
Limit the eye rotation to 22.5 degrees.
This commit is contained in:
parent
12ce268f5c
commit
09240dba27
1 changed files with 4 additions and 1 deletions
|
@ -62,5 +62,8 @@ void FaceModel::maybeUpdateEyeRotation(const JointState& parentState, const FBXJ
|
||||||
glm::vec3 front = glm::vec3(inverse * glm::vec4(_owningHead->getOrientation() * IDENTITY_FRONT, 0.0f));
|
glm::vec3 front = glm::vec3(inverse * glm::vec4(_owningHead->getOrientation() * IDENTITY_FRONT, 0.0f));
|
||||||
glm::vec3 lookAt = glm::vec3(inverse * glm::vec4(_owningHead->getLookAtPosition() +
|
glm::vec3 lookAt = glm::vec3(inverse * glm::vec4(_owningHead->getLookAtPosition() +
|
||||||
_owningHead->getSaccade(), 1.0f));
|
_owningHead->getSaccade(), 1.0f));
|
||||||
state.rotation = rotationBetween(front, lookAt) * joint.rotation;
|
glm::quat between = rotationBetween(front, lookAt);
|
||||||
|
const float MAX_ANGLE = 22.5f;
|
||||||
|
state.rotation = glm::angleAxis(glm::clamp(glm::angle(between), -MAX_ANGLE, MAX_ANGLE), glm::axis(between)) *
|
||||||
|
joint.rotation;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue