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
472472 //Injecting mouse movements and clicks
473473 void SixenseManager::emulateMouse(PalmData* palm, int index) {
474474 MyAvatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
475− auto glCanvas = Application::getInstance()->getGLWidget();
476475 QPoint pos;
477476
478477 Qt::MouseButton bumperButton;
@@ -498,12 +497,12 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) { · 19 unmodified lines
498497 // Get the angles, scaled between (-0.5,0.5)
499498 float xAngle = (atan2(direction.z, direction.x) + M_PI_2);
500499 float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
501−
500+ auto canvasSize = qApp->getCanvasSize();
502501 // Get the pixel range over which the xAngle and yAngle are scaled
503− float cursorRange = glCanvas->width() * getCursorPixelRangeMult();
502+ float cursorRange = canvasSize.x * getCursorPixelRangeMult();
504503
505− pos.setX(glCanvas->width() / 2.0f + cursorRange * xAngle);
506− pos.setY(glCanvas->height() / 2.0f + cursorRange * yAngle);
504+ pos.setX(canvasSize.x / 2.0f + cursorRange * xAngle);
505+ pos.setY(canvasSize.y / 2.0f + cursorRange * yAngle);
507506
508507 }
509508