mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 02:52:57 +02:00
Let's try using the neck parent rotation, rather than the neck, to fix
separate heads.
This commit is contained in:
parent
9e6b29951d
commit
3a4dfb92f6
3 changed files with 19 additions and 4 deletions
|
@ -29,11 +29,11 @@ void FaceModel::simulate(float deltaTime, bool fullUpdate) {
|
||||||
neckPosition = owningAvatar->getPosition();
|
neckPosition = owningAvatar->getPosition();
|
||||||
}
|
}
|
||||||
setTranslation(neckPosition);
|
setTranslation(neckPosition);
|
||||||
glm::quat neckRotation;
|
glm::quat neckParentRotation;
|
||||||
if (!owningAvatar->getSkeletonModel().getNeckRotation(neckRotation)) {
|
if (!owningAvatar->getSkeletonModel().getNeckParentRotation(neckParentRotation)) {
|
||||||
neckRotation = owningAvatar->getOrientation();
|
neckParentRotation = owningAvatar->getOrientation();
|
||||||
}
|
}
|
||||||
setRotation(neckRotation);
|
setRotation(neckParentRotation);
|
||||||
const float MODEL_SCALE = 0.0006f;
|
const float MODEL_SCALE = 0.0006f;
|
||||||
setScale(glm::vec3(1.0f, 1.0f, 1.0f) * _owningHead->getScale() * MODEL_SCALE);
|
setScale(glm::vec3(1.0f, 1.0f, 1.0f) * _owningHead->getScale() * MODEL_SCALE);
|
||||||
|
|
||||||
|
|
|
@ -434,6 +434,17 @@ bool Model::getNeckRotation(glm::quat& neckRotation) const {
|
||||||
return isActive() && getJointRotation(_geometry->getFBXGeometry().neckJointIndex, neckRotation);
|
return isActive() && getJointRotation(_geometry->getFBXGeometry().neckJointIndex, neckRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Model::getNeckParentRotation(glm::quat& neckParentRotation) const {
|
||||||
|
if (!isActive()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
||||||
|
if (geometry.neckJointIndex == -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return getJointRotation(geometry.joints.at(geometry.neckJointIndex).parentIndex, neckParentRotation);
|
||||||
|
}
|
||||||
|
|
||||||
bool Model::getEyePositions(glm::vec3& firstEyePosition, glm::vec3& secondEyePosition) const {
|
bool Model::getEyePositions(glm::vec3& firstEyePosition, glm::vec3& secondEyePosition) const {
|
||||||
if (!isActive()) {
|
if (!isActive()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -132,6 +132,10 @@ public:
|
||||||
/// \return whether or not the neck was found
|
/// \return whether or not the neck was found
|
||||||
bool getNeckRotation(glm::quat& neckRotation) const;
|
bool getNeckRotation(glm::quat& neckRotation) const;
|
||||||
|
|
||||||
|
/// Returns the rotation of the neck joint's parent.
|
||||||
|
/// \return whether or not the neck was found
|
||||||
|
bool getNeckParentRotation(glm::quat& neckRotation) const;
|
||||||
|
|
||||||
/// Retrieve the positions of up to two eye meshes.
|
/// Retrieve the positions of up to two eye meshes.
|
||||||
/// \return whether or not both eye meshes were found
|
/// \return whether or not both eye meshes were found
|
||||||
bool getEyePositions(glm::vec3& firstEyePosition, glm::vec3& secondEyePosition) const;
|
bool getEyePositions(glm::vec3& firstEyePosition, glm::vec3& secondEyePosition) const;
|
||||||
|
|
Loading…
Reference in a new issue