QWR Core Overview
QWR Core is the main package of the QWR SDK, providing comprehensive tools for XR development in Unity. It includes hand tracking, controller support, XR Origin setup, interaction systems, and multiplayer networking capabilities.
Package Structure
The QWR Core package is organized into several key components:
Prefabs
Ready-to-use prefabs for quick implementation:
- QWR XR Origin: Complete XR setup with camera rig, tracking, and interaction systems
- QWR Hand: Realistic hand models with animations and tracking
- QWR Hand Controller: Hand tracking controllers with interaction capabilities
- Touch Controllers: Visual representations of physical controllers
Scripts
The scripting architecture is divided into several namespaces:
- QWR.Core.Tracking: Hand and controller tracking systems
- QWR.Core.Interaction: Interaction system for grabbing and manipulating objects
- QWR.Core.UI: UI interaction components for XR interfaces
- QWR.Core.Multiplayer: Networking components for multiplayer experiences
- QWR.Core.Input: Input management and action mapping
Assets
Visual and functional assets:
- Hand Models: Realistic hand meshes with animations
- Controller Models: Visual representations of controllers
- Materials: Specialized materials for hands and interactions
- Animations: Hand poses and animations for different interactions
Core Components
QWRXROrigin
The central component that manages the XR camera rig and tracking:
// Key properties and methods
QWRXROrigin.Instance.CameraTransform // Access the main camera transform
QWRXROrigin.Instance.SetPlayerHeight(height) // Adjust player height
QWRXROrigin.Instance.RecenterView() // Recenter the player's view
QWRHandController
Manages hand tracking and interactions:
// Access hand controllers
QWRHandController leftHand = QWRHandController.LeftHand;
QWRHandController rightHand = QWRHandController.RightHand;
// Key properties
bool isTracked = leftHand.IsTracked;
bool isGrabbing = leftHand.IsGrabbing;
HandPose currentPose = leftHand.CurrentPose;
// Events
leftHand.OnGrabBegin += HandleGrabBegin;
leftHand.OnGrabEnd += HandleGrabEnd;
leftHand.OnPoseChanged += HandlePoseChanged;
QWRInputManager
Handles input from controllers and other devices:
// Access input values
float triggerValue = QWRInputManager.Instance.GetTriggerValue(HandType.Right);
Vector2 thumbstick = QWRInputManager.Instance.GetThumbstickValue(HandType.Left);
// Subscribe to events
QWRInputManager.Instance.OnTriggerPressed += HandleTriggerPress;
QWRInputManager.Instance.OnMenuButtonPressed += HandleMenuPress;
QWRInteractionManager
Manages interactions between hands/controllers and objects:
// Register interactable objects
QWRInteractionManager.Instance.RegisterInteractable(myInteractable);
// Query interactions
bool isInteracting = QWRInteractionManager.Instance.IsInteracting(HandType.Right);
QWRInteractable currentObject = QWRInteractionManager.Instance.GetInteractedObject(HandType.Left);
QWRNetworkManager
Handles multiplayer networking:
// Connect to a session
QWRNetworkManager.Instance.Connect(roomCode);
// Spawn networked objects
GameObject networkedObject = QWRNetworkManager.Instance.SpawnNetworkedObject(prefab, position, rotation);
// Events
QWRNetworkManager.Instance.OnPlayerJoined += HandlePlayerJoined;
QWRNetworkManager.Instance.OnPlayerLeft += HandlePlayerLeft;
Integration with Unity XR
QWR Core is built on top of Unity's XR frameworks and extends them with additional functionality:
- Integrates with Unity's XR Plugin Management
- Extends XR Interaction Toolkit with enhanced grabbing and physics
- Provides custom input actions built on Unity's Input System
- Works seamlessly with OpenXR
Next Steps
Explore the individual components in more detail:
- XR Origin Setup: Learn about the QWR XR Origin prefab and its components
- Hand Tracking: Discover the hand tracking system
- Controller Support: Explore controller input and haptic feedback
- Interaction System: Learn about the physics-based interaction system
- UI Interaction: Discover how to create XR user interfaces
- Multiplayer: Set up networked multiplayer experiences