mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 07:00:14 +02:00
Screens: find the controllers' laser tip during VR games too
GetComponentStateForDevicePath with no input source handle fails for every render model component while a VR game runs (checked 2026-10-03 with a game up: all 21 components of frame_controller_right). TipOffset then fell back to the controller's pose, which aims 40 degrees above the Frame controller's laser. In games, pointing at a screen's middle missed it and pointing below it hit, so the new aim-to-laser only worked from the bottom; the controls' reveal and pin/roll aim were off the same way. GetComponentState still answers then, with the same tip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b12b7d74e
commit
c699e13104
2 files changed
+7
-3
No files matched your search
+6
-2
@@ -190,8 +190,12 @@ Mat TipOffset(vr::TrackedDeviceIndex_t dev) {
|
||||
Tip tip{model, Identity(), false, now};
|
||||
vr::RenderModel_ControllerMode_State_t mode{};
|
||||
vr::RenderModel_ComponentState_t state{};
|
||||
if (model[0] && vr::VRRenderModels()->GetComponentStateForDevicePath(model, vr::k_pch_Controller_Component_Tip,
|
||||
vr::k_ulInvalidInputValueHandle, &mode, &state))
|
||||
// GetComponentState, not GetComponentStateForDevicePath: without an input source handle
|
||||
// the latter fails for every component while a VR game runs, and the rays came from the
|
||||
// pose, 40 degrees above the laser. The tip doesn't move with the buttons.
|
||||
vr::VRControllerState_t buttons{};
|
||||
if (model[0] && vr::VRRenderModels()->GetComponentState(model, vr::k_pch_Controller_Component_Tip, &buttons, &mode,
|
||||
&state))
|
||||
tip.offset = state.mTrackingToComponentLocal, tip.found = true;
|
||||
cache[dev] = tip;
|
||||
return tip.offset;
|
||||
|
||||
Reference in new issue
Block a user