-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Residue selection using the laser pointer of VR controllers #378
Comments
Hi. I haven't tried PyMOL with the OpenVR implementation in a while, but this block seems to suggest that selection should already be possible: pymol-open-source/layer3/Executive.cpp Line 11231 in 03d7a7f
|
Hi, thank you for your response. You are right, the piece of code you highlighted picks the position of the pointed atom, but it only appears to be using it to limit the length of the laser pointer, unless I'm missing something. For the record, I'm using PyMOL 3.0.0 on Ubuntu 22.04 with an Oculus Quest 3 device using ALVR. I was not able to select any atom or residue in VR without using the sequence viewer, but I don't exclude the possibility that it may be a controller configuration issue. Perhaps (and I may be completely off-track here, of course) actual atom selection could happen by providing the pymol-open-source/layer1/SceneMouse.cpp Line 230 in a0d739f
or a similar function whenever the user inputs the equivalent of a click through the controller? |
Ah, your interpretation was right. I didn't look into Unless anyone else speaks up, I would just assume that this was just not implemented. 😄 |
I was able to select atoms by introducing this function Function Codevoid OpenVRSelectPickedAtom(PyMOLGlobals * G)
{
CScene *Scene = G->Scene;
if(Scene->LastPicked.context.object == NULL) {
return;
}
COpenVR *I = G->OpenVR;
OpenVRActionList* Actions = I->Actions;
Actions->Update(I->Input);
OpenVRAction* userActions[] = {Actions->Action1, Actions->Action2, Actions->Action3};
OpenVRController& RightHand = I->Hands[HRight];
for (int i = 0, n = sizeof(userActions) / sizeof(*userActions); i < n; ++i) {
OpenVRAction* action = userActions[i];
if (action->WasReleased()) {
EHand handIndex = EHand(action->DeviceIndex() == RightHand.m_deviceIndex);
EUserActionSet userActionSet = I->UserActionSet[handIndex];
EUserAction userAction = s_userActionMapping[userActionSet][i];
switch (userAction) {
case UserAction_Mouse_LClick:
SceneClickObject(G, Scene->LastPicked.context.object, Scene->LastPicked, cButModeSeleToggle, "");
break;
}
}
}
} and calling it after One issue I am encountering is that the selection seems to happen a few centimeters under the laser. As can be seen in the following screenshot, the index of the atom picked by ScenePickAtomInWorld (printed in the terminal and circled in red in the viewport) does not correspond to the index of the atom pointed by the laser.: |
Retrieved a VR headset for me to test this. I haven't opened PyMOL VR in many years, so I'm still learning the ropes again. I think the issue is due to this line: pymol-open-source/layer1/ScenePicking.cpp Line 15 in d82b626
|
To the best of my knowledge, it is not currently possible to select a residue by pointing the VR controller's laser directly at the target (akin to clicking with the mouse on the molecule while in desktop mode). Has this feature ever been considered?
I would be interested in looking into ways to implement it, but I would like to know beforehand if there have already been attempts (or if I'm missing an already-existing feature!).
The text was updated successfully, but these errors were encountered: