History

Fixing sixense and restoring lookat

Bradley Austin Davis committed 11 years ago

Commit 098a9bd1 parent fb3e3096 files · +65 −8Browse files

Showing the changes to interface/src/devices/SixenseManager.cpp (1 of 6 files). Show all

Unified · Split

interface/src/devices/SixenseManager.cpp+4−5
@@ -472,7 +472,6 @@ void SixenseManager::updateCalibration(const sixenseControllerData* controllers) · 471 unmodified lines
472//Injecting mouse movements and clicks472//Injecting mouse movements and clicks
473void SixenseManager::emulateMouse(PalmData* palm, int index) {473void SixenseManager::emulateMouse(PalmData* palm, int index) {
474 MyAvatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();474 MyAvatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
475 auto glCanvas = Application::getInstance()->getGLWidget();
476 QPoint pos;475 QPoint pos;
477 476
478 Qt::MouseButton bumperButton;477 Qt::MouseButton bumperButton;
@@ -498,12 +497,12 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) { · 19 unmodified lines
498 // Get the angles, scaled between (-0.5,0.5)497 // Get the angles, scaled between (-0.5,0.5)
499 float xAngle = (atan2(direction.z, direction.x) + M_PI_2);498 float xAngle = (atan2(direction.z, direction.x) + M_PI_2);
500 float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));499 float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
501 500 auto canvasSize = qApp->getCanvasSize();
502 // Get the pixel range over which the xAngle and yAngle are scaled501 // Get the pixel range over which the xAngle and yAngle are scaled
503 float cursorRange = glCanvas->width() * getCursorPixelRangeMult();502 float cursorRange = canvasSize.x * getCursorPixelRangeMult();
504 503
505 pos.setX(glCanvas->width() / 2.0f + cursorRange * xAngle);504 pos.setX(canvasSize.x / 2.0f + cursorRange * xAngle);
506 pos.setY(glCanvas->height() / 2.0f + cursorRange * yAngle);505 pos.setY(canvasSize.y / 2.0f + cursorRange * yAngle);
507 506
508 }507 }
509 508