Merge pull request #2940 from AndrewMeadows/inertia

fix for lack of neck rotations
This commit is contained in:
Brad Hefta-Gaub 2014-05-28 11:00:55 -07:00
commit 9546fe477c
2 changed files with 19 additions and 1 deletions

View file

@ -70,6 +70,23 @@ void FaceModel::maybeUpdateEyeRotation(const JointState& parentState, const FBXJ
joint.rotation;
}
void FaceModel::updateJointState(int index) {
JointState& state = _jointStates[index];
const FBXGeometry& geometry = _geometry->getFBXGeometry();
const FBXJoint& joint = geometry.joints.at(index);
if (joint.parentIndex != -1) {
const JointState& parentState = _jointStates.at(joint.parentIndex);
if (index == geometry.neckJointIndex) {
maybeUpdateNeckRotation(parentState, joint, state);
} else if (index == geometry.leftEyeJointIndex || index == geometry.rightEyeJointIndex) {
maybeUpdateEyeRotation(parentState, joint, state);
}
}
Model::updateJointState(index);
}
bool FaceModel::getEyePositions(glm::vec3& firstEyePosition, glm::vec3& secondEyePosition) const {
if (!isActive()) {
return false;

View file

@ -28,7 +28,8 @@ public:
virtual void maybeUpdateNeckRotation(const JointState& parentState, const FBXJoint& joint, JointState& state);
virtual void maybeUpdateEyeRotation(const JointState& parentState, const FBXJoint& joint, JointState& state);
virtual void updateJointState(int index);
/// Retrieve the positions of up to two eye meshes.
/// \return whether or not both eye meshes were found
bool getEyePositions(glm::vec3& firstEyePosition, glm::vec3& secondEyePosition) const;