Merge branch 'vive' of github.com:Atlante45/hifi into baseball

This commit is contained in:
Atlante45 2015-11-03 11:40:45 -08:00
commit 2bdd282708
3 changed files with 27 additions and 22 deletions

View file

@ -62,7 +62,7 @@ void AvatarActionHold::updateActionWorker(float deltaTimeStep) {
if (it != std::end(plugins)) {
const auto& vive = it->dynamicCast<ViveControllerManager>();
auto index = (_hand == "right") ? 0 : 1;
auto index = (_hand == "left") ? 0 : 1;
auto userInputMapper = DependencyManager::get<UserInputMapper>();
auto translation = extractTranslation(userInputMapper->getSensorToWorldMat());
auto rotation = glm::quat_cast(userInputMapper->getSensorToWorldMat());
@ -71,7 +71,7 @@ void AvatarActionHold::updateActionWorker(float deltaTimeStep) {
const glm::quat quarterX = glm::angleAxis(PI / 2.0f, glm::vec3(1.0f, 0.0f, 0.0f));
const glm::quat yFlip = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f));
palmPosition = translation + rotation * vive->getPosition(index);
palmRotation = rotation * vive->getRotation(index) * yFlip * quarterX;
palmRotation = rotation * vive->getRotation(index) * yFlip * quarterX * glm::angleAxis(PI, glm::vec3(1.0f, 0.0f, 0.0f)) * glm::angleAxis(PI_OVER_TWO, glm::vec3(0.0f, 0.0f, 1.0f));
} else
#endif
if (_hand == "right") {

View file

@ -285,7 +285,13 @@ void ViveControllerManager::update(float deltaTime, bool jointsCaptured) {
handleButtonEvent(i, pressed, left);
}
for (uint32_t i = 0; i < vr::k_unControllerStateAxisCount; i++) {
auto mask = vr::ButtonMaskFromId((vr::EVRButtonId)(i + vr::k_EButton_Axis0));
bool pressed = 0 != (controllerState.ulButtonPressed & mask);
if (pressed || true) {
handleAxisEvent(i, controllerState.rAxis[i].x, controllerState.rAxis[i].y, left);
} else {
handleAxisEvent(i, 0.0f, 0.0f, left);
}
}
}
}
@ -422,7 +428,6 @@ void ViveControllerManager::handlePoseEvent(const mat4& mat, bool left) {
position += rotation * translationOffset;
rotation = rotation * rotationOffset;
//{quat, x = 0.653281, y = -0.270598, z = 0.653281, w = 0.270598}{vec3, x = 0.0381, y = -0.0381, z = -0.1524}
_poseStateMap[left ? controller::LEFT_HAND : controller::RIGHT_HAND] = controller::Pose(position, rotation);
}