From 13e6e640d34259cafb8b3b949b2feec19d121c39 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sat, 17 Jan 2026 20:03:58 +0100 Subject: [PATCH] add MosisPointerComponent VR interaction documentation --- CLAUDE.md | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index baec0f8..94b95e7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -626,6 +626,92 @@ rmdir /s /q "Binaries" - Android Build Tools 36.1.0 (for AIDL compiler) - `ANDROID_HOME` environment variable set +#### VR Pointer Interaction + +The MosisSDK includes `UMosisPointerComponent` for VR ray-based touch interaction. + +**Key Files**: +- `Public/MosisPointerComponent.h` - Component header +- `Private/MosisPointerComponent.cpp` - Implementation + +**Features**: +- Raycast from component transform (attach as child of motion controller) +- Automatic detection of `AMosisPhoneActor` hits +- Touch state machine: Down/Move/Up events +- Optional Enhanced Input binding via `TriggerAction` property +- Manual control via `SetTriggerPressed(bool)` +- Debug ray visualization + +**Blueprint Setup**: +1. Add `MosisPointerComponent` as child of `MotionControllerComponent` +2. Set `TriggerAction` to your trigger input action (optional) +3. Touch events are sent automatically when pointing at phone and triggering + +**C++ Setup**: +```cpp +// In VR Pawn header +UPROPERTY(VisibleAnywhere) +UMosisPointerComponent* RightPointer; + +// In constructor +RightPointer = CreateDefaultSubobject(TEXT("RightPointer")); +RightPointer->SetupAttachment(RightMotionController); + +// In BeginPlay (if using Enhanced Input) +RightPointer->TriggerAction = TriggerInputAction; +``` + +**Manual Control (without Enhanced Input)**: +```cpp +// In your input handling code +void AMyVRPawn::OnTriggerPressed() +{ + RightPointer->SetTriggerPressed(true); +} + +void AMyVRPawn::OnTriggerReleased() +{ + RightPointer->SetTriggerPressed(false); +} +``` + +**Component Properties**: + +| Property | Type | Default | Description | +|----------|------|---------|-------------| +| `RayLength` | float | 500.0 | Maximum ray length in cm | +| `bShowDebugRay` | bool | false | Draw debug visualization | +| `DebugRayColor` | FLinearColor | Red | Ray color when not hitting | +| `DebugRayHitColor` | FLinearColor | Green | Ray color when hitting phone | +| `TraceChannel` | ECollisionChannel | Visibility | Collision channel for raycast | +| `TriggerAction` | UInputAction* | nullptr | Enhanced Input action for trigger | + +**Blueprint Functions**: + +| Function | Returns | Description | +|----------|---------|-------------| +| `IsPointingAtPhone()` | bool | True if ray hits a phone actor | +| `GetTargetPhone()` | AMosisPhoneActor* | Currently targeted phone (or nullptr) | +| `GetHitLocation()` | FVector | World location of ray hit | +| `GetRayOrigin()` | FVector | Ray start position | +| `GetRayDirection()` | FVector | Ray direction vector | +| `IsTriggerPressed()` | bool | Current trigger state | +| `SetTriggerPressed(bool)` | void | Manual trigger control | + +**Touch State Machine**: +``` +Idle ──[raycast hit]──► Hover ──[trigger]──► Pressed + ▲ │ │ + │ │ raycast miss │ trigger release + │ ▼ ▼ + └──────────────────── Idle ◄──────────────────── + +Events: +- Idle → Pressed: SendTouch(Down) +- Pressed + moving: SendTouch(Move) +- Pressed → Idle: SendTouch(Up) +``` + ### MosisVR (Unity 6000.3.2f1) **Location**: `D:\Dev\Mosis\MosisVR\Packages\com.omixlab.mosis_sdk\`