Remove lean from head rotation

This commit is contained in:
Atlante45 2015-01-08 11:33:14 -08:00
parent 0bae05b924
commit 4157a3ca40

View file

@ -49,16 +49,22 @@ void FaceModel::maybeUpdateNeckRotation(const JointState& parentState, const FBX
Avatar* owningAvatar = static_cast<Avatar*>(_owningHead->_owningAvatar); Avatar* owningAvatar = static_cast<Avatar*>(_owningHead->_owningAvatar);
// get the rotation axes in joint space and use them to adjust the rotation // get the rotation axes in joint space and use them to adjust the rotation
glm::mat3 axes = glm::mat3_cast(glm::quat()); glm::mat3 axes = glm::mat3_cast(glm::quat());
glm::mat3 inverse = glm::mat3(glm::inverse(parentState.getTransform() * glm::translate(state.getDefaultTranslationInConstrainedFrame()) * glm::mat3 inverse = glm::mat3(glm::inverse(parentState.getTransform() *
joint.preTransform * glm::mat4_cast(joint.preRotation))); glm::translate(state.getDefaultTranslationInConstrainedFrame()) *
state.setRotationInConstrainedFrame( joint.preTransform * glm::mat4_cast(joint.preRotation)));
glm::angleAxis(- RADIANS_PER_DEGREE * (_owningHead->getFinalRoll() - owningAvatar->getHead()->getFinalLeanSideways()), glm::vec3 pitchYawRoll = safeEulerAngles(_owningHead->getFinalOrientationInLocalFrame());
glm::normalize(inverse * axes[2])) if (owningAvatar->isMyAvatar()) {
* glm::angleAxis(RADIANS_PER_DEGREE * (_owningHead->getFinalYaw() - _owningHead->getTorsoTwist()), glm::vec3 lean = glm::radians(glm::vec3(_owningHead->getFinalLeanForward(),
glm::normalize(inverse * axes[1])) _owningHead->getTorsoTwist(),
* glm::angleAxis(- RADIANS_PER_DEGREE * (_owningHead->getFinalPitch() - owningAvatar->getHead()->getFinalLeanForward()), _owningHead->getFinalLeanSideways()));
glm::normalize(inverse * axes[0])) pitchYawRoll -= lean;
* joint.rotation, DEFAULT_PRIORITY); }
state.setRotationInConstrainedFrame(glm::angleAxis(-pitchYawRoll.z, glm::normalize(inverse * axes[2]))
* glm::angleAxis(pitchYawRoll.y, glm::normalize(inverse * axes[1]))
* glm::angleAxis(-pitchYawRoll.x, glm::normalize(inverse * axes[0]))
* joint.rotation, DEFAULT_PRIORITY);
} }
void FaceModel::maybeUpdateEyeRotation(Model* model, const JointState& parentState, const FBXJoint& joint, JointState& state) { void FaceModel::maybeUpdateEyeRotation(Model* model, const JointState& parentState, const FBXJoint& joint, JointState& state) {