Walkthrough 2: VR Laser Pointer Clicks & Hover
This tutorial demonstrates how to connect your VR Motion Controller's laser raycast to Quest 3D WebView for clicking and hovering.
🎯 Objective
Enable VR laser pointing so players can hover over web elements (triggering animations and drop-down menus) and click web links using the index trigger.
🛠️ Step 1: Continuous Laser Hover (Tick)
In your VR Character/Pawn (e.g. VRPawn), on Event Tick:
- Perform a
LineTraceByChannelfrom the right controller forward vector (e.g. Length = 500 cm). - If
Hit Resulthits an Actor containing aQuestWebViewComponent:- Call
Find Collision UVon the Hit Result. - Check
UV.X >= 0.0andUV.Y >= 0.0. - Call
SendHoverEventUV(Action: Move, UV: HitUV)on the hit WebView component.
- Call
text
[ Event Tick ] ──► [ LineTraceByChannel ] ──► ( Hit? ) ──► [ Find Collision UV ]
│
▼
[ SendHoverEventUV (Move) ]🛠️ Step 2: Trigger Clicks (InputAction)
When the player presses the VR Index Trigger:
- On
IA_Grab_Right (Started): - From the last valid hit UV coordinate, call
ClickUV(HitUV)on the targetQuestWebViewComponent.
text
[ EnhancedInputAction (Started) ] ──► [ ClickUV (HitUV) ]No Zero-Coordinate Branching Needed
Connect the trigger action directly to ClickUV with the last valid trace UV to prevent dropped click events!