Merge branch 'master' of https://github.com/worklist/hifi into 19483

This commit is contained in:
stojce 2014-01-17 20:56:40 +01:00
commit 01b9bd61ad
2 changed files with 14 additions and 21 deletions

View file

@ -65,7 +65,7 @@ void FaceModel::maybeUpdateNeckRotation(const JointState& parentState, const FBX
void FaceModel::maybeUpdateEyeRotation(const JointState& parentState, const FBXJoint& joint, JointState& state) { void FaceModel::maybeUpdateEyeRotation(const JointState& parentState, const FBXJoint& joint, JointState& state) {
// likewise with the eye joints // likewise with the eye joints
glm::mat4 inverse = glm::inverse(parentState.transform * glm::mat4 inverse = glm::inverse(parentState.transform * glm::translate(state.translation) *
joint.preTransform * glm::mat4_cast(joint.preRotation * joint.rotation)); joint.preTransform * glm::mat4_cast(joint.preRotation * joint.rotation));
glm::vec3 front = glm::vec3(inverse * glm::vec4(_owningHead->getOrientation() * IDENTITY_FRONT, 0.0f)); glm::vec3 front = glm::vec3(inverse * glm::vec4(_owningHead->getOrientation() * IDENTITY_FRONT, 0.0f));
glm::vec3 lookAt = glm::vec3(inverse * glm::vec4(_owningHead->getLookAtPosition() + glm::vec3 lookAt = glm::vec3(inverse * glm::vec4(_owningHead->getLookAtPosition() +

View file

@ -180,29 +180,22 @@ void MyAvatar::simulate(float deltaTime, Transmitter* transmitter) {
const float OCULUS_ACCELERATION_PULL_THRESHOLD = 1.0f; const float OCULUS_ACCELERATION_PULL_THRESHOLD = 1.0f;
const int OCULUS_YAW_OFFSET_THRESHOLD = 10; const int OCULUS_YAW_OFFSET_THRESHOLD = 10;
if (!Application::getInstance()->getFaceshift()->isActive()) { if (!Application::getInstance()->getFaceshift()->isActive() && OculusManager::isConnected() &&
// Decay HeadPitch as a function of acceleration, so that you look straight ahead when fabsf(forwardAcceleration) > OCULUS_ACCELERATION_PULL_THRESHOLD &&
// you start moving, but don't do this with an HMD like the Oculus. fabs(_head.getYaw()) > OCULUS_YAW_OFFSET_THRESHOLD) {
if (!OculusManager::isConnected()) {
if (forwardAcceleration > ACCELERATION_PULL_THRESHOLD) { // if we're wearing the oculus
_head.setMousePitch(_head.getMousePitch() * qMax(0.0f, // and this acceleration is above the pull threshold
(1.f - forwardAcceleration * ACCELERATION_PITCH_DECAY * deltaTime))); // and the head yaw if off the body by more than OCULUS_YAW_OFFSET_THRESHOLD
}
} else if (fabsf(forwardAcceleration) > OCULUS_ACCELERATION_PULL_THRESHOLD
&& fabs(_head.getYaw()) > OCULUS_YAW_OFFSET_THRESHOLD) {
// if we're wearing the oculus
// and this acceleration is above the pull threshold
// and the head yaw if off the body by more than OCULUS_YAW_OFFSET_THRESHOLD
// match the body yaw to the oculus yaw // match the body yaw to the oculus yaw
_bodyYaw = getAbsoluteHeadYaw(); _bodyYaw = getAbsoluteHeadYaw();
// set the head yaw to zero for this draw // set the head yaw to zero for this draw
_head.setYaw(0); _head.setYaw(0);
// correct the oculus yaw offset // correct the oculus yaw offset
OculusManager::updateYawOffset(); OculusManager::updateYawOffset();
}
} }
const float WALKING_SPEED_THRESHOLD = 0.2f; const float WALKING_SPEED_THRESHOLD = 0.2f;