starting the c++ version of shoulder rotation

This commit is contained in:
Angus Antley 2018-08-23 15:57:14 +01:00
parent 874d9251e7
commit 30ef544c6d
2 changed files with 16 additions and 0 deletions

View file

@ -801,6 +801,17 @@ void MyAvatar::updateFromHMDSensorMatrix(const glm::mat4& hmdSensorMatrix) {
}
}
void MyAvatar::computeHandAzimuth() {
controller::Pose leftHandPoseAvatarSpace = getLeftHandPose();
controller::Pose rightHandPoseAvatarSpace = getRightHandPose();
glm::vec3 localLookat(0.0f, 0.0f, 1.0f);
glm::vec3 rightHandRigSpace = rightHandPoseAvatarSpace.rotation * localLookat;
glm::vec3 lefttHandRigSpace = leftHandPoseAvatarSpace.rotation * localLookat;
_hipToHandController = glm::vec2(rightHandRigSpace.x, rightHandRigSpace.z);
}
void MyAvatar::updateJointFromController(controller::Action poseKey, ThreadSafeValueCache<glm::mat4>& matrixCache) {
assert(QThread::currentThread() == thread());
auto userInputMapper = DependencyManager::get<UserInputMapper>();

View file

@ -320,6 +320,9 @@ public:
// as it moves through the world.
void updateFromHMDSensorMatrix(const glm::mat4& hmdSensorMatrix);
// compute the hip to hand average azimuth.
void computeHandAzimuth();
// read the location of a hand controller and save the transform
void updateJointFromController(controller::Action poseKey, ThreadSafeValueCache<glm::mat4>& matrixCache);
@ -1658,6 +1661,8 @@ private:
glm::vec2 _headControllerFacingMovingAverage { 0.0f, 0.0f }; // facing vector in xz plane (sensor space)
glm::quat _averageHeadRotation { 0.0f, 0.0f, 0.0f, 1.0f };
glm::vec2 _hipToHandController; // facing vector in xz plane (sensor space)
float _currentStandingHeight { 0.0f };
bool _resetMode { true };
RingBufferHistory<int> _recentModeReadings;