add MosisPointerComponent VR interaction documentation
This commit is contained in:
86
CLAUDE.md
86
CLAUDE.md
@@ -626,6 +626,92 @@ rmdir /s /q "Binaries"
|
|||||||
- Android Build Tools 36.1.0 (for AIDL compiler)
|
- Android Build Tools 36.1.0 (for AIDL compiler)
|
||||||
- `ANDROID_HOME` environment variable set
|
- `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<UMosisPointerComponent>(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)
|
### MosisVR (Unity 6000.3.2f1)
|
||||||
|
|
||||||
**Location**: `D:\Dev\Mosis\MosisVR\Packages\com.omixlab.mosis_sdk\`
|
**Location**: `D:\Dev\Mosis\MosisVR\Packages\com.omixlab.mosis_sdk\`
|
||||||
|
|||||||
Reference in New Issue
Block a user