mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 08:36:26 +02:00
update refactored logic to match previous application behavior
This commit is contained in:
parent
f10535d991
commit
ef0e32643d
2 changed files with 20 additions and 16 deletions
|
@ -38,6 +38,13 @@ void MySkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
||||||
|
|
||||||
// make sure lookAt is not too close to face (avoid crosseyes)
|
// make sure lookAt is not too close to face (avoid crosseyes)
|
||||||
glm::vec3 lookAt = _owningAvatar->isMyAvatar() ? head->getLookAtPosition() : head->getCorrectedLookAtPosition();
|
glm::vec3 lookAt = _owningAvatar->isMyAvatar() ? head->getLookAtPosition() : head->getCorrectedLookAtPosition();
|
||||||
|
glm::vec3 focusOffset = lookAt - _owningAvatar->getHead()->getEyePosition();
|
||||||
|
float focusDistance = glm::length(focusOffset);
|
||||||
|
const float MIN_LOOK_AT_FOCUS_DISTANCE = 1.0f;
|
||||||
|
if (focusDistance < MIN_LOOK_AT_FOCUS_DISTANCE && focusDistance > EPSILON) {
|
||||||
|
lookAt = _owningAvatar->getHead()->getEyePosition() + (MIN_LOOK_AT_FOCUS_DISTANCE / focusDistance) * focusOffset;
|
||||||
|
}
|
||||||
|
|
||||||
MyAvatar* myAvatar = static_cast<MyAvatar*>(_owningAvatar);
|
MyAvatar* myAvatar = static_cast<MyAvatar*>(_owningAvatar);
|
||||||
|
|
||||||
Rig::HeadParameters headParams;
|
Rig::HeadParameters headParams;
|
||||||
|
|
|
@ -73,20 +73,20 @@ void SkeletonModel::initJointStates() {
|
||||||
|
|
||||||
// Called within Model::simulate call, below.
|
// Called within Model::simulate call, below.
|
||||||
void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
||||||
const FBXGeometry& geometry = getFBXGeometry();
|
|
||||||
|
|
||||||
Head* head = _owningAvatar->getHead();
|
|
||||||
|
|
||||||
// make sure lookAt is not too close to face (avoid crosseyes)
|
|
||||||
glm::vec3 lookAt = _owningAvatar->isMyAvatar() ? head->getLookAtPosition() : head->getCorrectedLookAtPosition();
|
|
||||||
glm::vec3 focusOffset = lookAt - _owningAvatar->getHead()->getEyePosition();
|
|
||||||
float focusDistance = glm::length(focusOffset);
|
|
||||||
const float MIN_LOOK_AT_FOCUS_DISTANCE = 1.0f;
|
|
||||||
if (focusDistance < MIN_LOOK_AT_FOCUS_DISTANCE && focusDistance > EPSILON) {
|
|
||||||
lookAt = _owningAvatar->getHead()->getEyePosition() + (MIN_LOOK_AT_FOCUS_DISTANCE / focusDistance) * focusOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_owningAvatar->isMyAvatar()) {
|
if (!_owningAvatar->isMyAvatar()) {
|
||||||
|
const FBXGeometry& geometry = getFBXGeometry();
|
||||||
|
|
||||||
|
Head* head = _owningAvatar->getHead();
|
||||||
|
|
||||||
|
// make sure lookAt is not too close to face (avoid crosseyes)
|
||||||
|
glm::vec3 lookAt = _owningAvatar->isMyAvatar() ? head->getLookAtPosition() : head->getCorrectedLookAtPosition();
|
||||||
|
glm::vec3 focusOffset = lookAt - _owningAvatar->getHead()->getEyePosition();
|
||||||
|
float focusDistance = glm::length(focusOffset);
|
||||||
|
const float MIN_LOOK_AT_FOCUS_DISTANCE = 1.0f;
|
||||||
|
if (focusDistance < MIN_LOOK_AT_FOCUS_DISTANCE && focusDistance > EPSILON) {
|
||||||
|
lookAt = _owningAvatar->getHead()->getEyePosition() + (MIN_LOOK_AT_FOCUS_DISTANCE / focusDistance) * focusOffset;
|
||||||
|
}
|
||||||
|
|
||||||
// no need to call Model::updateRig() because otherAvatars get their joint state
|
// no need to call Model::updateRig() because otherAvatars get their joint state
|
||||||
// copied directly from AvtarData::_jointData (there are no Rig animations to blend)
|
// copied directly from AvtarData::_jointData (there are no Rig animations to blend)
|
||||||
_needsUpdateClusterMatrices = true;
|
_needsUpdateClusterMatrices = true;
|
||||||
|
@ -118,9 +118,6 @@ void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
||||||
|
|
||||||
_rig->updateFromEyeParameters(eyeParams);
|
_rig->updateFromEyeParameters(eyeParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
// evaluate AnimGraph animation and update jointStates.
|
|
||||||
Parent::updateRig(deltaTime, parentTransform);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonModel::updateAttitude() {
|
void SkeletonModel::updateAttitude() {
|
||||||
|
|
Loading…
Reference in a new issue