schrodinger / pymol-open-source

Open-source foundation of the user-sponsored PyMOL molecular visualization system.
https://pymol.org/
Other
1.2k stars 281 forks source link

[WIP] Allow atom selection via VR controllers #399

Open Nargaruga opened 2 months ago

Nargaruga commented 2 months ago

This allows the user to select atoms by pointing the laser and pressing the button mapped to Action1 (typically the trigger), as requested in #378.

Some problems are still present:

Possible improvements:

Additional notes:

Nargaruga commented 1 month ago

there is a considerable offset between the laser pointer and the atom that is actually selected. Reducing cRange in layer1/ScenePicking.cpp does not seem to improve the situation by much.

Applying a vertical offset to the picking projection parameters seems to solve the issue (see commit 43ab48e3fa873b055d51b9b576a83d3148575ac0). The change does not seem to influence other VR interactions (i.e. with the menu or the sequence viewer).

Before the change (the purple color of the laser indicates that an atom is being pointed at, which shouldn't be the case here)
![before_offset](https://github.com/user-attachments/assets/38bb4ade-d3c2-485d-9e8d-cf102e7a1e9f)
After the change
![after_offset](https://github.com/user-attachments/assets/07ae662d-2ce6-4341-9ccc-7a564b7e9cf6)

This is a band-aid solution, I assume the correct approach would be to update the following parameters: https://github.com/schrodinger/pymol-open-source/blob/9d3061ca58d8b69d7dad74a68fc13fe81af0ff8e/contrib/vr/OpenVRStub.cpp#L137-L150 But I do not know how they were first extrapolated, nor if they are tied to a specific VR headset (I'm testing the changes on a Meta Quest 3).