1111
1212namespace Microsoft . MixedReality . Toolkit . Internal . Devices . OpenVR
1313{
14- // TODO - Implement
1514 public class GenericOpenVRController : BaseController
1615 {
1716 public GenericOpenVRController ( TrackingState trackingState , Handedness controllerHandedness , IMixedRealityInputSource inputSource = null , MixedRealityInteractionMapping [ ] interactions = null )
1817 : base ( trackingState , controllerHandedness , inputSource , interactions )
1918 {
19+ //Prepare the Axis Mapping data for the OpenVR Controller
2020 Initialise ( ) ;
2121
2222 //Verify the OpenVR Controller mappings are loaded
@@ -47,6 +47,9 @@ public GenericOpenVRController(TrackingState trackingState, Handedness controlle
4747
4848 private InputMappingAxisUtility . InputManagerAxis [ ] OpenVRControllerAxisMappings ;
4949
50+ /// <summary>
51+ /// Mapping method to expose the Unity Input Manager mapping configuration
52+ /// </summary>
5053 public virtual InputMappingAxisUtility . InputManagerAxis [ ] ControllerAxisMappings => OpenVRControllerAxisMappings ;
5154
5255 /// <summary>
@@ -68,8 +71,14 @@ public GenericOpenVRController(TrackingState trackingState, Handedness controlle
6871 "OPENVR_GRIP_RIGHT_CONTROLLER" // 11 - GRIP_RIGHT_CONTROLLER
6972 } ;
7073
74+ /// <summary>
75+ /// Mapping method to expose this controllers Unity Input Manager mapping array
76+ /// </summary>
7177 public virtual string [ ] VRInputMappings => OpenVRInputMappings ;
7278
79+ /// <summary>
80+ /// Initialize the Axis mappings for the Unity Input Manager mappings
81+ /// </summary>
7382 public virtual void Initialise ( )
7483 {
7584 OpenVRControllerAxisMappings = new InputMappingAxisUtility . InputManagerAxis [ ]
@@ -211,8 +220,6 @@ protected void UpdateGripData(MixedRealityInteractionMapping interactionMapping)
211220 // If our value changed raise it.
212221 if ( interactionMapping . Changed )
213222 {
214- Debug . LogWarning ( $ "Grip pressed for [{ ControllerHandedness } ] hand, set to [{ gripButton } ]") ;
215-
216223 //Raise input system Event if it enabled
217224 if ( gripButton > 0 )
218225 {
@@ -233,8 +240,6 @@ protected void UpdateGripData(MixedRealityInteractionMapping interactionMapping)
233240 // If our value changed raise it.
234241 if ( interactionMapping . Changed )
235242 {
236- Debug . LogWarning ( $ "Grip pressed for [{ ControllerHandedness } ] hand, set to [{ gripButton } ]") ;
237-
238243 //Raise input system Event if it enabled
239244 InputSystem ? . RaiseOnInputPressed ( InputSource , ControllerHandedness , interactionMapping . MixedRealityInputAction , gripButton ) ;
240245 }
@@ -263,8 +268,6 @@ protected void UpdateTouchPadData(MixedRealityInteractionMapping interactionMapp
263268 // If our value changed raise it.
264269 if ( interactionMapping . Changed )
265270 {
266- Debug . LogWarning ( $ "TouchpadTouch pressed for [{ ControllerHandedness } ] hand, set to [{ touchpadTouchButton } ]") ;
267-
268271 //Raise input system Event if it enabled
269272 if ( touchpadTouchButton )
270273 {
@@ -288,8 +291,6 @@ protected void UpdateTouchPadData(MixedRealityInteractionMapping interactionMapp
288291 // If our value changed raise it.
289292 if ( interactionMapping . Changed )
290293 {
291- Debug . LogWarning ( $ "TouchpadPress pressed for [{ ControllerHandedness } ] hand, set to [{ touchpadPressButton } ]") ;
292-
293294 //Raise input system Event if it enabled
294295 if ( touchpadPressButton )
295296 {
@@ -314,8 +315,6 @@ protected void UpdateTouchPadData(MixedRealityInteractionMapping interactionMapp
314315 //If our value changed raise it.
315316 if ( interactionMapping . Changed )
316317 {
317- Debug . LogWarning ( $ "Touchpad pressed for [{ ControllerHandedness } ] hand, set to [{ touchpadPosition } ]") ;
318-
319318 //Raise input system Event if it enabled
320319 InputSystem ? . RaisePositionInputChanged ( InputSource , ControllerHandedness , interactionMapping . MixedRealityInputAction , touchpadPosition ) ;
321320 }
@@ -346,8 +345,6 @@ protected void UpdateThumbStickData(MixedRealityInteractionMapping interactionMa
346345 // If our value changed raise it.
347346 if ( interactionMapping . Changed )
348347 {
349- Debug . LogWarning ( $ "ThumbStickPress pressed for [{ ControllerHandedness } ] hand, set to [{ thumbstickButton } ]") ;
350-
351348 //Raise input system Event if it enabled
352349 if ( thumbstickButton )
353350 {
@@ -372,8 +369,6 @@ protected void UpdateThumbStickData(MixedRealityInteractionMapping interactionMa
372369 // If our value changed raise it.
373370 if ( interactionMapping . Changed )
374371 {
375- Debug . LogWarning ( $ "Thumbstick pressed for [{ ControllerHandedness } ] hand, set to [{ thumbstickposition } ]") ;
376-
377372 //Raise input system Event if it enabled
378373 InputSystem ? . RaisePositionInputChanged ( InputSource , ControllerHandedness , interactionMapping . MixedRealityInputAction , thumbstickposition ) ;
379374 }
@@ -405,8 +400,6 @@ protected void UpdateTriggerData(MixedRealityInteractionMapping interactionMappi
405400 // If our value changed raise it.
406401 if ( interactionMapping . Changed )
407402 {
408- Debug . LogWarning ( $ "Trigger pressed for [{ ControllerHandedness } ] hand, set to [{ triggerButton } ]") ;
409-
410403 //Raise input system Event if it enabled
411404 if ( triggerButton )
412405 {
@@ -430,8 +423,6 @@ protected void UpdateTriggerData(MixedRealityInteractionMapping interactionMappi
430423 // If our value changed raise it.
431424 if ( interactionMapping . Changed )
432425 {
433- Debug . LogWarning ( $ "Trigger pressed for [{ ControllerHandedness } ] hand, set to [{ triggerAxis } ] value") ;
434-
435426 //Raise input system Event if it enabled
436427 InputSystem ? . RaiseOnInputPressed ( InputSource , ControllerHandedness , interactionMapping . MixedRealityInputAction , triggerAxis ) ;
437428 }
@@ -443,22 +434,21 @@ protected void UpdateTriggerData(MixedRealityInteractionMapping interactionMappi
443434 }
444435
445436 /// <summary>
446- /// Update the Menu button state.
437+ /// Update the buttons state.
447438 /// </summary>
448439 /// <param name="interactionSourceState"></param>
449440 /// <param name="interactionMapping"></param>
450441 protected virtual void UpdateButtonData ( MixedRealityInteractionMapping interactionMapping )
451442 {
452443 //Get the current Menu button state
453444 var menuButton = ControllerHandedness == Handedness . Left ? Input . GetKey ( KeyCode . JoystickButton2 ) : Input . GetKey ( KeyCode . JoystickButton0 ) ;
445+
454446 //Update the interaction data source
455447 interactionMapping . SetBoolValue ( menuButton ) ;
456448
457449 // If our value changed raise it.
458450 if ( interactionMapping . Changed )
459451 {
460- Debug . LogWarning ( $ "Menu pressed for [{ ControllerHandedness } ] hand, set to [{ menuButton } ]") ;
461-
462452 //Raise input system Event if it enabled
463453 if ( menuButton )
464454 {
0 commit comments