From 676a8882fe15507f7a9eb1505100ae0f1fc8594b Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 28 May 2014 10:43:21 -0700 Subject: [PATCH] fix for no neck motion FaceModel needs similar override to updateJointState() as SkeletonModel --- interface/src/avatar/FaceModel.cpp | 17 +++++++++++++++++ interface/src/avatar/FaceModel.h | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/interface/src/avatar/FaceModel.cpp b/interface/src/avatar/FaceModel.cpp index eaa9875641..2cf2f70068 100644 --- a/interface/src/avatar/FaceModel.cpp +++ b/interface/src/avatar/FaceModel.cpp @@ -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; diff --git a/interface/src/avatar/FaceModel.h b/interface/src/avatar/FaceModel.h index c3462f42ac..c71bb9a8aa 100644 --- a/interface/src/avatar/FaceModel.h +++ b/interface/src/avatar/FaceModel.h @@ -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;