QWR Core API Reference
This page provides a comprehensive API reference for the QWR Core package. It documents the key classes, interfaces, and methods available in the SDK.
Namespace: QWR.Core
The main namespace for QWR Core components.
QWRXROrigin
The central component that manages the XR camera rig and tracking.
Properties
| Name | Type | Description |
|---|---|---|
Instance | QWRXROrigin | Static instance of the QWR XR Origin. |
CameraTransform | Transform | The transform of the main XR camera. |
TrackingOriginMode | TrackingOriginMode | The current tracking origin mode (Device or Floor). |
PlayerHeight | float | The height of the player in meters. |
IsInitialized | bool | Whether the XR Origin is fully initialized. |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
Initialize() | void | None | Initializes the XR Origin. |
RecenterView() | void | None | Recenters the player's view. |
SetPlayerHeight(float height) | void | height: The player height in meters | Sets the player's height. |
SetTrackingOriginMode(TrackingOriginMode mode) | void | mode: The tracking origin mode | Sets the tracking origin mode. |
GetLocalPosition() | Vector3 | None | Gets the local position of the XR Origin. |
GetWorldPosition() | Vector3 | None | Gets the world position of the XR Origin. |
TeleportTo(Vector3 position, Quaternion rotation) | void | position: Target position, rotation: Target rotation | Teleports the XR Origin to the specified position and rotation. |
Events
| Name | Event Type | Description |
|---|---|---|
OnInitialized | Action | Triggered when the XR Origin is initialized. |
OnRecenterView | Action | Triggered when the view is recentered. |
OnTrackingOriginChanged | Action<TrackingOriginMode> | Triggered when the tracking origin mode changes. |
QWRHandController
Manages hand tracking and interactions.
Properties
| Name | Type | Description |
|---|---|---|
LeftHand | QWRHandController | Static reference to the left hand controller. |
RightHand | QWRHandController | Static reference to the right hand controller. |
HandType | HandType | The type of hand (Left or Right). |
IsTracked | bool | Whether the hand is currently tracked. |
IsGrabbing | bool | Whether the hand is currently grabbing something. |
CurrentPose | HandPose | The current pose of the hand. |
CurrentGesture | HandGesture | The current gesture being performed. |
TrackingConfidence | float | The confidence level of hand tracking (0-1). |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
GetFingerBend(FingerType finger) | float | finger: The finger to check | Gets the bend amount of the specified finger (0-1). |
GetFingerTipPosition(FingerType finger) | Vector3 | finger: The finger to check | Gets the world position of the specified finger tip. |
IsGesture(HandGesture gesture) | bool | gesture: The gesture to check | Checks if the hand is performing the specified gesture. |
TriggerHapticFeedback(float amplitude, float duration) | void | amplitude: Strength (0-1), duration: Time in seconds | Triggers haptic feedback on the hand controller. |
SetVisibility(bool visible) | void | visible: Whether the hand should be visible | Sets the visibility of the hand model. |
RegisterCustomGesture(string name, QWRGestureDefinition definition) | void | name: Gesture name, definition: Gesture definition | Registers a custom gesture for recognition. |
SetModelDetailLevel(int level) | void | level: Detail level (0-2) | Sets the detail level of the hand model. |
Events
| Name | Event Type | Description |
|---|---|---|
OnTrackingAcquired | Action<QWRHandController> | Triggered when hand tracking is acquired. |
OnTrackingLost | Action<QWRHandController> | Triggered when hand tracking is lost. |
OnGrabBegin | Action<QWRHandController, QWRInteractable> | Triggered when the hand starts grabbing an object. |
OnGrabEnd | Action<QWRHandController, QWRInteractable> | Triggered when the hand stops grabbing an object. |
OnPoseChanged | Action<QWRHandController, HandPose> | Triggered when the hand pose changes. |
OnGestureBegin | Action<QWRHandController, HandGesture> | Triggered when a gesture begins. |
OnGestureEnd | Action<QWRHandController, HandGesture> | Triggered when a gesture ends. |
QWRInputManager
Handles input from controllers and other devices.
Properties
| Name | Type | Description |
|---|---|---|
Instance | QWRInputManager | Static instance of the input manager. |
InputMode | InputMode | The current input mode (Hands, Controllers, or Auto). |
IsLeftControllerConnected | bool | Whether the left controller is connected. |
IsRightControllerConnected | bool | Whether the right controller is connected. |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
GetTriggerValue(HandType hand) | float | hand: The hand to check | Gets the trigger value (0-1) for the specified hand. |
GetGripValue(HandType hand) | float | hand: The hand to check | Gets the grip value (0-1) for the specified hand. |
GetThumbstickValue(HandType hand) | Vector2 | hand: The hand to check | Gets the thumbstick/touchpad position for the specified hand. |
IsPrimaryButtonPressed(HandType hand) | bool | hand: The hand to check | Checks if the primary button is pressed on the specified hand. |
IsSecondaryButtonPressed(HandType hand) | bool | hand: The hand to check | Checks if the secondary button is pressed on the specified hand. |
IsMenuButtonPressed(HandType hand) | bool | hand: The hand to check | Checks if the menu button is pressed on the specified hand. |
TriggerHapticFeedback(HandType hand, float amplitude, float duration) | void | hand: Target hand, amplitude: Strength (0-1), duration: Time in seconds | Triggers haptic feedback on the specified controller. |
TriggerHapticPattern(HandType hand, string patternName) | void | hand: Target hand, patternName: Pattern identifier | Triggers a predefined haptic pattern on the specified controller. |
SetInputMode(InputMode mode) | void | mode: The input mode to set | Sets the input mode. |
Events
| Name | Event Type | Description |
|---|---|---|
OnTriggerPressed | Action<HandType> | Triggered when the trigger button is pressed. |
OnTriggerReleased | Action<HandType> | Triggered when the trigger button is released. |
OnGripPressed | Action<HandType> | Triggered when the grip button is pressed. |
OnGripReleased | Action<HandType> | Triggered when the grip button is released. |
OnPrimaryButtonPressed | Action<HandType> | Triggered when the primary button is pressed. |
OnPrimaryButtonReleased | Action<HandType> | Triggered when the primary button is released. |
OnSecondaryButtonPressed | Action<HandType> | Triggered when the secondary button is pressed. |
OnSecondaryButtonReleased | Action<HandType> | Triggered when the secondary button is released. |
OnMenuButtonPressed | Action<HandType> | Triggered when the menu button is pressed. |
OnMenuButtonReleased | Action<HandType> | Triggered when the menu button is released. |
OnThumbstickMoved | Action<HandType, Vector2> | Triggered when the thumbstick/touchpad is moved. |
OnThumbstickClicked | Action<HandType> | Triggered when the thumbstick/touchpad is clicked. |
OnInputModeChanged | Action<InputMode> | Triggered when the input mode changes. |
QWRInteractionManager
Manages interactions between hands/controllers and objects.
Properties
| Name | Type | Description |
|---|---|---|
Instance | QWRInteractionManager | Static instance of the interaction manager. |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
RegisterInteractable(QWRInteractable interactable) | void | interactable: The interactable to register | Registers an interactable object with the interaction manager. |
UnregisterInteractable(QWRInteractable interactable) | void | interactable: The interactable to unregister | Unregisters an interactable object from the interaction manager. |
IsInteracting(HandType hand) | bool | hand: The hand to check | Checks if the specified hand is currently interacting with an object. |
GetInteractedObject(HandType hand) | QWRInteractable | hand: The hand to check | Gets the object currently being interacted with by the specified hand. |
ForceGrab(HandType hand, QWRInteractable interactable) | bool | hand: The hand to use, interactable: Target object | Forces the specified hand to grab the interactable object. |
ForceRelease(HandType hand) | void | hand: The hand to release | Forces the specified hand to release any grabbed object. |
Events
| Name | Event Type | Description |
|---|---|---|
OnObjectGrabbed | Action<QWRInteractor, QWRInteractable> | Triggered when an object is grabbed. |
OnObjectReleased | Action<QWRInteractor, QWRInteractable> | Triggered when an object is released. |
OnObjectHoverBegin | Action<QWRInteractor, QWRInteractable> | Triggered when an object hover begins. |
OnObjectHoverEnd | Action<QWRInteractor, QWRInteractable> | Triggered when an object hover ends. |
QWRNetworkManager
Handles multiplayer networking functionality.
Properties
| Name | Type | Description |
|---|---|---|
Instance | QWRNetworkManager | Static instance of the network manager. |
IsConnected | bool | Whether the player is connected to a room. |
IsHost | bool | Whether the player is the host of the current room. |
CurrentRoomCode | string | The code of the current room. |
LocalPlayer | QWRNetworkPlayer | The local player object. |
LocalPlayerAvatar | QWRNetworkAvatar | The local player's avatar. |
PlayerCount | int | The number of players in the current room. |
MaxPlayers | int | The maximum number of players allowed in a room. |
VoiceChat | QWRVoiceChat | The voice chat system. |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
StartHost(string roomName, int maxPlayers) | void | roomName: Room name, maxPlayers: Maximum players | Starts hosting a new room. |
JoinRoom(string roomCode) | void | roomCode: Room code to join | Joins an existing room. |
JoinOrCreateRoom(string roomName) | void | roomName: Room name | Joins an existing room or creates a new one. |
Disconnect() | void | None | Disconnects from the current room. |
GetAllPlayers() | QWRNetworkPlayer[] | None | Gets all connected players. |
SetPlayerName(string name) | void | name: Player name | Sets the local player's name. |
SendCustomMessage(int messageType, string data) | void | messageType: Message identifier, data: Message content | Sends a custom message to all players. |
RegisterNetworkObject(QWRNetworkObject obj) | void | obj: Object to register | Registers a network object for synchronization. |
AuthenticateAsync() | Task<bool> | None | Authenticates the player with the network service. |
CreateRoomAsync(string roomName, int maxPlayers, bool isPrivate) | Task<bool> | roomName: Room name, maxPlayers: Maximum players, isPrivate: Privacy setting | Creates a new room asynchronously. |
JoinRoomAsync(string roomCode) | Task<bool> | roomCode: Room code to join | Joins an existing room asynchronously. |
Events
| Name | Event Type | Description |
|---|---|---|
OnConnected | Action | Triggered when connected to a room. |
OnDisconnected | Action | Triggered when disconnected from a room. |
OnRoomJoined | Action<string> | Triggered when a room is joined. |
OnRoomLeft | Action | Triggered when a room is left. |
OnPlayerJoined | Action<QWRNetworkPlayer> | Triggered when a player joins the room. |
OnPlayerLeft | Action<QWRNetworkPlayer> | Triggered when a player leaves the room. |
OnCustomMessageReceived | Action<QWRNetworkPlayer, int, string> | Triggered when a custom message is received. |
Namespace: QWR.Core.Interaction
Contains components related to the interaction system.
QWRInteractable
Makes an object interactable with hands and controllers.
Properties
| Name | Type | Description |
|---|---|---|
GrabType | GrabType | The types of interactors that can grab this object. |
PhysicsGrabMode | PhysicsGrabMode | The physics mode when grabbed. |
IsGrabbed | bool | Whether the object is currently grabbed. |
CurrentGrabber | QWRInteractor | The interactor currently grabbing this object. |
SnapToHand | bool | Whether the object should snap to the hand when grabbed. |
TwoHandedGrabEnabled | bool | Whether two-handed grabbing is enabled. |
ThrowVelocityMultiplier | float | Multiplier for throw velocity. |
GrabPoints | QWRGrabPoint[] | Array of grab points on this object. |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
Grab(QWRInteractor interactor) | bool | interactor: The interactor grabbing the object | Attempts to grab the object with the specified interactor. |
Release(QWRInteractor interactor) | void | interactor: The interactor releasing the object | Releases the object from the specified interactor. |
AddGrabPoint(QWRGrabPoint grabPoint) | void | grabPoint: The grab point to add | Adds a grab point to the object. |
RemoveGrabPoint(QWRGrabPoint grabPoint) | void | grabPoint: The grab point to remove | Removes a grab point from the object. |
GetNearestGrabPoint(Vector3 position, HandType handType) | QWRGrabPoint | position: Query position, handType: Hand type | Gets the nearest grab point to the specified position for the specified hand. |
Events
| Name | Event Type | Description |
|---|---|---|
OnGrabbed | Action<QWRInteractor> | Triggered when the object is grabbed. |
OnReleased | Action<QWRInteractor> | Triggered when the object is released. |
OnHoverEnter | Action<QWRInteractor> | Triggered when an interactor starts hovering over the object. |
OnHoverExit | Action<QWRInteractor> | Triggered when an interactor stops hovering over the object. |
QWRInteractor
Represents an entity that can interact with objects (like hands or controllers).
Properties
| Name | Type | Description |
|---|---|---|
InteractorType | InteractorType | The type of interactor (Hand or Controller). |
HandType | HandType | The hand type (Left or Right). |
IsGrabbing | bool | Whether the interactor is currently grabbing something. |
CurrentInteractable | QWRInteractable | The object currently being interacted with. |
HoveredInteractable | QWRInteractable | The object currently being hovered over. |
GrabPoint | Transform | The transform representing the grab point. |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
TryGrab() | bool | None | Attempts to grab the currently hovered object. |
ForceGrab(QWRInteractable interactable) | bool | interactable: The object to grab | Forces a grab on the specified object. |
Release() | void | None | Releases the currently grabbed object. |
CanGrab(QWRInteractable interactable) | bool | interactable: The object to check | Checks if the interactor can grab the specified object. |
Events
| Name | Event Type | Description |
|---|---|---|
OnGrabBegin | Action<QWRInteractor, QWRInteractable> | Triggered when a grab begins. |
OnGrabEnd | Action<QWRInteractor, QWRInteractable> | Triggered when a grab ends. |
OnHoverEnter | Action<QWRInteractor, QWRInteractable> | Triggered when hovering over an object begins. |
OnHoverExit | Action<QWRInteractor, QWRInteractable> | Triggered when hovering over an object ends. |
QWRGrabPoint
Defines a specific point on an interactable object where it can be grabbed.
Properties
| Name | Type | Description |
|---|---|---|
HandType | HandType | The hand type that can use this grab point. |
HandPose | HandPose | The hand pose to use when grabbing this point. |
SnapPosition | bool | Whether the hand should snap to this position. |
SnapRotation | bool | Whether the hand should snap to this rotation. |
CustomPose | QWRHandPoseDefinition | Custom hand pose definition. |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
GetPoseTransform() | Transform | None | Gets the transform for hand positioning. |
CanBeGrabbedBy(HandType handType) | bool | handType: Hand type to check | Checks if this grab point can be grabbed by the specified hand. |
Namespace: QWR.Core.UI
Contains components related to UI interaction.
QWRUIManager
The central component that coordinates all UI interactions.
Properties
| Name | Type | Description |
|---|---|---|
Instance | QWRUIManager | Static instance of the UI manager. |
RayInteractionEnabled | bool | Whether ray interaction is enabled. |
DirectTouchInteractionEnabled | bool | Whether direct touch interaction is enabled. |
HapticFeedbackEnabled | bool | Whether haptic feedback is enabled for UI interactions. |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
RegisterCanvas(QWRUICanvas canvas) | void | canvas: The canvas to register | Registers a UI canvas with the manager. |
UnregisterCanvas(QWRUICanvas canvas) | void | canvas: The canvas to unregister | Unregisters a UI canvas from the manager. |
SetGlobalInteractionMode(UIInteractionMode mode) | void | mode: The interaction mode to set | Sets the global UI interaction mode. |
QWRUICanvas
Makes a Unity Canvas interactable in XR.
Properties
| Name | Type | Description |
|---|---|---|
InteractionMode | UIInteractionMode | The interaction mode for this canvas. |
FollowType | UIFollowType | How the canvas follows the user. |
FollowDistance | float | The distance at which the canvas follows the user. |
FollowSmoothTime | float | Smoothing time for canvas movement. |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
SetInteractionMode(UIInteractionMode mode) | void | mode: The interaction mode to set | Sets the interaction mode for this canvas. |
SetFollowType(UIFollowType followType) | void | followType: The follow type to set | Sets how the canvas follows the user. |
SetFollowDistance(float distance) | void | distance: The follow distance | Sets the distance at which the canvas follows the user. |
QWRUIInteractor
Allows hands or controllers to interact with UI elements.
Properties
| Name | Type | Description |
|---|---|---|
InteractionType | UIInteractionType | The type of UI interaction (Ray or DirectTouch). |
RayColor | Color | The color of the interaction ray. |
RayThickness | float | The thickness of the interaction ray. |
RayLength | float | The length of the interaction ray. |
ShowRayOnHoverOnly | bool | Whether to show the ray only when hovering over UI. |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
SetInteractionType(UIInteractionType type) | void | type: The interaction type to set | Sets the UI interaction type. |
SetRayVisualization(bool enabled) | void | enabled: Whether ray visualization is enabled | Enables or disables ray visualization. |
TriggerHapticFeedback(float amplitude, float duration) | void | amplitude: Strength (0-1), duration: Time in seconds | Triggers haptic feedback for UI interaction. |
Events
| Name | Event Type | Description |
|---|---|---|
OnUIElementClicked | Action<GameObject> | Triggered when a UI element is clicked. |
OnUIElementHoverEnter | Action<GameObject> | Triggered when hovering over a UI element begins. |
OnUIElementHoverExit | Action<GameObject> | Triggered when hovering over a UI element ends. |
Namespace: QWR.Core.Multiplayer
Contains components related to multiplayer functionality.
QWRNetworkPlayer
Represents a player in the network.
Properties
| Name | Type | Description |
|---|---|---|
PlayerId | string | The unique identifier of the player. |
PlayerName | string | The display name of the player. |
IsLocal | bool | Whether this player is the local player. |
IsHost | bool | Whether this player is the host. |
Avatar | QWRNetworkAvatar | The player's avatar. |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
GetPosition() | Vector3 | None | Gets the player's position. |
GetRotation() | Quaternion | None | Gets the player's rotation. |
SetCustomProperty(string key, object value) | void | key: Property key, value: Property value | Sets a custom player property. |
GetCustomProperty(string key) | object | key: Property key | Gets a custom player property. |
SendDirectMessage(int messageType, string data) | void | messageType: Message identifier, data: Message content | Sends a message directly to this player. |
QWRNetworkObject
Makes an object synchronize over the network.
Properties
| Name | Type | Description |
|---|---|---|
IsOwner | bool | Whether the local player owns this object. |
Owner | QWRNetworkPlayer | The player who owns this object. |
SyncPosition | bool | Whether to synchronize position. |
SyncRotation | bool | Whether to synchronize rotation. |
SyncScale | bool | Whether to synchronize scale. |
SyncPhysics | bool | Whether to synchronize physics properties. |
UpdateRate | int | The update rate for synchronization. |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
TransferOwnership(QWRNetworkPlayer player) | void | player: The player to transfer ownership to | Transfers ownership of the object to the specified player. |
RequestOwnership() | void | None | Requests ownership of the object. |
NetworkDestroy() | void | None | Destroys the object across the network. |
SetCustomProperty(string key, object value) | void | key: Property key, value: Property value | Sets a custom object property. |
GetCustomProperty(string key) | object | key: Property key | Gets a custom object property. |
Events
| Name | Event Type | Description |
|---|---|---|
OnOwnershipChanged | Action<QWRNetworkObject, QWRNetworkPlayer> | Triggered when ownership changes. |
OnCustomPropertyChanged | Action<QWRNetworkObject, string, object> | Triggered when a custom property changes. |
QWRNetworkAvatar
Represents a player's avatar in the network.
Properties
| Name | Type | Description |
|---|---|---|
Player | QWRNetworkPlayer | The player this avatar represents. |
SyncHandAnimations | bool | Whether to synchronize hand animations. |
SyncControllerInputs | bool | Whether to synchronize controller inputs. |
UpdateRate | int | The update rate for synchronization. |
Methods
| Name | Return Type | Parameters | Description |
|---|---|---|---|
SetCustomAvatarModel(GameObject prefab) | void | prefab: The avatar model prefab | Sets a custom avatar model. |
SetVisibility(bool visible) | void | visible: Whether the avatar should be visible | Sets the visibility of the avatar. |
SetNameTagVisibility(bool visible) | void | visible: Whether the name tag should be visible | Sets the visibility of the name tag. |
Enums
HandType
public enum HandType
{
Left,
Right
}
InputMode
public enum InputMode
{
Hands,
Controllers,
Auto
}
GrabType
public enum GrabType
{
Hand,
Controller,
Both,
None
}
PhysicsGrabMode
public enum PhysicsGrabMode
{
Kinematic,
Velocity,
Joint
}
UIInteractionMode
public enum UIInteractionMode
{
Ray,
DirectTouch,
Both,
None
}
UIFollowType
public enum UIFollowType
{
None,
BodyLocked,
GazeLocked,
HandAttached
}
Interfaces
IQWRInteractable
public interface IQWRInteractable
{
bool IsGrabbed { get; }
QWRInteractor CurrentGrabber { get; }
bool Grab(QWRInteractor interactor);
void Release(QWRInteractor interactor);
void OnHoverEnter(QWRInteractor interactor);
void OnHoverExit(QWRInteractor interactor);
}
IQWRUIHandler
public interface IQWRUIHandler
{
void OnQWRPointerEnter(QWRPointerEventData eventData);
void OnQWRPointerExit(QWRPointerEventData eventData);
void OnQWRPointerDown(QWRPointerEventData eventData);
void OnQWRPointerUp(QWRPointerEventData eventData);
void OnQWRPointerClick(QWRPointerEventData eventData);
}
Next Steps
For more detailed information about specific components, check out the following pages:
- QWR Utilities API Reference: API reference for the QWR Utilities package
- Core Documentation: Comprehensive documentation for QWR Core features
- Utilities Documentation: Comprehensive documentation for QWR Utilities features