Skip to content

Commit

Permalink
Allow atom selection via VR controllers
Browse files Browse the repository at this point in the history
Implements #378
  • Loading branch information
Nargaruga committed Sep 17, 2024
1 parent 9d3061c commit b66db24
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions contrib/vr/OpenVRMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ SOFTWARE.
#include "Feedback.h"
#include "Matrix.h"
#include "Ortho.h"
#include "Scene.h"
#include "SceneMouse.h"
#include "ButMode.h"

// local headers
#include "OpenVRUtils.h"
Expand Down Expand Up @@ -1030,6 +1033,19 @@ void HandleLaser(PyMOLGlobals * G, int centerX, int centerY, CMouseEvent const&
}
}

// use the laser to pick an atom
CScene *Scene = G->Scene;
if (SettingGetGlobal_b(G, cSetting_openvr_cut_laser) && OpenVRIsScenePickerActive(G)) {
float atomWorldPos[3];
ScenePickAtomInWorld(G, centerX, centerY, atomWorldPos);
OpenVRUpdateScenePickerLength(G, atomWorldPos);
}

// if an atom was picked with the laser, select it
if(Actions->Action1->WasPressed() && Scene->LastPicked.context.object != NULL) {
SceneClickObject(G, Scene->LastPicked.context.object, Scene->LastPicked, cButModeSeleToggle, "");
}

bool menuHit = false;

if (laserSource) {
Expand Down

0 comments on commit b66db24

Please sign in to comment.