XRController3D
XR-rig controller: pose and named input.
XRController3D binds an Entity to a controller tracker. Parent directly under XROrigin3D; set Tracker=left_hand or right_hand first, then Pose=grip for a held-object visual. Numeric IDs 1/2 are not used here. Put artwork in a child Entity and adjust its local transform, because tracking replaces the controller transform.
IsButtonPressed, GetFloat and GetVector2 read internal action-map names, not labels or button paths. Without a tracker they return neutral values; these do not establish connection. Methods do not gate focus, tracking or interaction eligibility for you. GetInput returns an original-type Variant; dispose it with using.
Input events forward from the bound tracker and disconnect on unbinding. InputFloatChanged carries double although GetFloat returns float. ProfileChanged carries a profile string despite its argument being named role. Device removal does not guarantee ButtonReleased for every held action: clear interaction state on device or focus loss.
Synthetic tracker input, conversions, events, child transforms and unbinding were checked in the installed runtime. No real headset, physical vibration or rendered image was checked. Practical setup: XR components.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
XRController3DConstructor
public XRController3D();Creates a tracked Entity without a selected tracker. Parent directly under XROrigin3D, set Tracker, then Pose. Place artwork in a child Entity.
Methods5
GetFloatfloat
public float GetFloat(StringName name);Reads an action: Float is returned as float; Bool converts to 1 or 0. Returns 0 for Vector2, a missing value or no tracker. Does not normalize or clamp the range.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
nameExact internal action-map name; not a display label, button path or ordinary InputMap key.
floatfloat value; Bool yields 0/1, incompatible or absent data yields 0.
GetInputVariant
public Variant GetInput(StringName name);Returns the raw action-value Variant. Without a tracker or for an unknown name it is Variant.Type.Nil. Check the type before conversion; dispose the returned C# Variant wrapper with using. Neither an event nor proof of tracking.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
nameExact internal action-map name; not a display label, button path or ordinary InputMap key.
VariantOriginal-type Variant or Nil. Dispose the C# wrapper with using.
GetTrackerHandXRPositionalTracker.TrackerHand
public XRPositionalTracker.TrackerHand GetTrackerHand();Reads the bound tracker’s Hand; returns Unknown without a tracker. It is not inferred from the Tracker string. Hand assignment does not establish a current pose or input.
XRPositionalTracker.TrackerHandTracker Hand or Unknown; not derived from its name.
GetVector2Vector2
public Vector2 GetVector2(StringName name);Reads the action Vector2 unchanged. Float converts to (value, 0), Bool to (1, 0) or (0, 0); an unknown value or absent tracker yields Vector2.Zero. Applies no dead zone or normalization.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
nameExact internal action-map name; not a display label, button path or ordinary InputMap key.
Vector2Vector2; a scalar occupies X, absent data yields Vector2.Zero.
IsButtonPressedbool
public bool IsButtonPressed(StringName name);Reads the current Boolean action value by internal name, not a one-frame event. Returns false without a tracker or value. Does not check focus or pose freshness; gate those separately.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
nameExact internal action-map name; not a display label, button path or ordinary InputMap key.
boolCurrent bool; also false when input or tracker is absent.
Signals and events5
ButtonPressedEvent
public event XRController3D.ButtonPressedEventHandler ButtonPressed;Forwards the tracker event when a Boolean action changes to true, carrying its internal name. Does not repeat each held frame. Does not gate focus or tracking; an absent tracker creates no synthetic press.
| Name | Type | Default |
|---|---|---|
actionName | string | — |
actionNameInternal action name. A vibration request requires a configured output action.
ButtonReleasedEvent
public event XRController3D.ButtonReleasedEventHandler ButtonReleased;Forwards the tracker event when a Boolean action changes to false. Tracker removal does not itself synthesize releases for every button: reset interaction state on device or focus loss.
| Name | Type | Default |
|---|---|---|
actionName | string | — |
actionNameInternal action name. A vibration request requires a configured output action.
InputFloatChangedEvent
public event XRController3D.InputFloatChangedEventHandler InputFloatChanged;Forwards a changed numeric action and its name. The C# event value parameter is double; GetFloat returns float. Repeating the same value creates no event in the checked tracker. No automatic focus gate.
| Name | Type | Default |
|---|---|---|
actionName | string | — |
value | double | — |
actionNameInternal action name. A vibration request requires a configured output action.
valueNew event double value; not the float returned by GetFloat.
InputVector2ChangedEvent
public event XRController3D.InputVector2ChangedEventHandler InputVector2Changed;Forwards a changed Vector2 action and internal name. Does not normalize axes or add a dead zone. Events from the old tracker stop forwarding after unbinding.
| Name | Type | Default |
|---|---|---|
actionName | string | — |
value | Vector2 | — |
actionNameInternal action name. A vibration request requires a configured output action.
valueNew Vector2 without a dead zone or normalization.
ProfileChangedEvent
public event XRController3D.ProfileChangedEventHandler ProfileChanged;Forwards a profile change from the bound tracker. Despite the parameter name role, the value is a profile string, such as an interaction-profile path, not left/right. Does not establish runtime support for every binding.
| Name | Type | Default |
|---|---|---|
role | string | — |
roleTracker profile string; the parameter name is historical, not hand assignment.