XR Origin Setup
The QWR XR Origin prefab provides a complete setup for XR applications, serving as the foundation for your VR/AR experiences. This prefab includes camera tracking, hand tracking, controller input, and interaction systems.
QWR XR Origin Prefab
The QWR XR Origin prefab is a comprehensive solution that includes:
- Camera rig with proper tracking setup
- Hand tracking components
- Controller input system
- Interaction managers
- UI interaction capabilities
- Multiplayer networking support
Adding to Your Scene
- In your Project window, locate the
com.qwr.core/Prefabs/QWR_XROriginfolder - Drag and drop the
QWR XR Originprefab directly into your scene - The prefab will automatically be positioned at the origin (0,0,0)
You only need one QWR XR Origin in your scene. It manages all XR functionality for the player.
Prefab Structure
The QWR XR Origin prefab has the following hierarchy:
QWR XR Origin
├── Camera Offset
│ ├── Main Camera
│ ├── Left Hand Controller
│ │ └── Left Hand Model
│ ├── Right Hand Controller
│ │ └── Right Hand Model
│ ├── UI Interaction Ray (Left)
│ └── UI Interaction Ray (Right)
├── Tracking Origin
├── Interaction Manager
├── Input Manager
└── Network Manager
Key Components
Main Camera
The Main Camera is properly configured for XR rendering with:
- Appropriate near and far clipping planes
- Stereo rendering setup
- Optimized for XR performance
Hand Controllers
Each hand controller includes:
- Hand tracking components
- Visual hand models with animations
- Interaction components for grabbing and manipulation
- Ray interaction for distance interaction
Interaction Manager
The Interaction Manager coordinates all interactions between hands/controllers and objects in the scene:
- Manages grabbable objects
- Handles physics interactions
- Processes UI interactions
- Coordinates hand poses during interactions
Input Manager
The Input Manager processes input from controllers and other devices:
- Maps physical inputs to actions
- Provides events for button presses and releases
- Handles haptic feedback
- Manages input action assets
Network Manager
The Network Manager handles multiplayer functionality:
- Player synchronization
- Hand and controller network representation
- Object ownership and synchronization
- Voice communication
Customizing the XR Origin
Adjusting Player Height
You can adjust the player's height programmatically:
// Set player height in meters
QWRXROrigin.Instance.SetPlayerHeight(1.8f);
// Get current player height
float currentHeight = QWRXROrigin.Instance.PlayerHeight;
Or through the inspector by adjusting the Player Height property on the QWRXROrigin component.
Changing Hand Models
To use custom hand models:
- In the Project window, locate your custom hand model prefabs
- In the scene hierarchy, select
QWR XR Origin > Camera Offset > Left Hand Controller - In the Inspector, find the
QWRHandControllercomponent - Replace the
Hand Model Prefabreference with your custom model
Custom hand models need to follow the same bone structure as the default models for animations to work properly.
Configuring Input Actions
The QWR XR Origin uses Unity's Input System with a custom input action asset:
- In the Project window, locate
com.qwr.core/Inputs/QWR XRI Default Input Actions - You can create a duplicate of this asset to customize it
- Assign your custom input actions to the
QWRInputManagercomponent on the XR Origin
Advanced Configuration
Tracking Origin Mode
You can change the tracking origin mode to match your XR setup:
// Set tracking origin to floor level
QWRXROrigin.Instance.SetTrackingOriginMode(TrackingOriginMode.Floor);
// Set tracking origin to device level
QWRXROrigin.Instance.SetTrackingOriginMode(TrackingOriginMode.Device);
Recenter View
To recenter the player's view:
// Recenter the XR Origin based on current head position
QWRXROrigin.Instance.RecenterView();
Performance Settings
The QWR XR Origin includes performance optimization settings:
- In the scene hierarchy, select the
QWR XR OriginGameObject - In the Inspector, find the
QWRPerformanceManagercomponent - Adjust settings like:
- Hand model LOD levels
- Physics update rate
- Interaction distance thresholds
Common Issues
Tracking Issues
If you experience tracking problems:
- Ensure your XR device is properly connected and calibrated
- Check that the correct XR plug-in provider is enabled in Project Settings
- Verify that the tracking origin mode matches your physical setup
Performance Problems
For performance optimization:
- Reduce the polygon count of hand models
- Adjust physics interaction settings
- Enable performance mode in the
QWRPerformanceManager - Use the built-in profiling tools to identify bottlenecks
Input Not Working
If controller input isn't working:
- Verify that the correct interaction profiles are enabled in OpenXR settings
- Check that the input action mappings match your controller type
- Ensure the
QWRInputManageris properly initialized
Next Steps
Now that you understand the QWR XR Origin setup, you can explore:
- Hand Tracking: Learn about the hand tracking system
- Controller Support: Explore controller input and haptic feedback
- Interaction System: Discover the physics-based interaction system