Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
added controller data provider reference to the controller (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHodgson authored Apr 7, 2020
1 parent cb45086 commit 3ca952d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
13 changes: 4 additions & 9 deletions Controllers/WindowsMixedRealityController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using XRTK.Definitions.InputSystem;
using XRTK.Definitions.Utilities;
using XRTK.Interfaces.InputSystem;
using XRTK.Interfaces.Providers.Controllers;
using XRTK.Providers.Controllers;

#if UNITY_WSA
Expand All @@ -21,15 +22,9 @@ namespace XRTK.WindowsMixedReality.Controllers
/// </summary>
public class WindowsMixedRealityController : BaseController
{
/// <summary>
/// Constructor.
/// </summary>
/// <param name="trackingState"></param>
/// <param name="controllerHandedness"></param>
/// <param name="inputSource"></param>
/// <param name="interactions"></param>
public WindowsMixedRealityController(TrackingState trackingState, Handedness controllerHandedness, IMixedRealityInputSource inputSource = null, MixedRealityInteractionMapping[] interactions = null)
: base(trackingState, controllerHandedness, inputSource, interactions)
/// <inheritdoc />
public WindowsMixedRealityController(IMixedRealityControllerDataProvider controllerDataProvider, TrackingState trackingState, Handedness controllerHandedness, IMixedRealityInputSource inputSource = null, MixedRealityInteractionMapping[] interactions = null)
: base(controllerDataProvider, trackingState, controllerHandedness, inputSource, interactions)
{
}

Expand Down
4 changes: 2 additions & 2 deletions Controllers/WindowsMixedRealityControllerDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ private WindowsMixedRealityController GetController(InteractionSource interactio
var pointers = interactionSource.supportsPointing ? RequestPointers(typeof(WindowsMixedRealityController), controllingHand) : null;
var nameModifier = controllingHand == Handedness.None ? interactionSource.kind.ToString() : controllingHand.ToString();
var inputSource = MixedRealityToolkit.InputSystem?.RequestNewGenericInputSource($"Mixed Reality Controller {nameModifier}", pointers);
var detectedController = new WindowsMixedRealityController(TrackingState.NotApplicable, controllingHand, inputSource);
var detectedController = new WindowsMixedRealityController(this, TrackingState.NotApplicable, controllingHand, inputSource);

if (!detectedController.SetupConfiguration(typeof(WindowsMixedRealityController)))
{
Expand Down Expand Up @@ -505,11 +505,11 @@ private void RemoveController(InteractionSourceState interactionSourceState, boo
if (controller != null)
{
MixedRealityToolkit.InputSystem?.RaiseSourceLost(controller.InputSource, controller);
RemoveController(controller);
}

if (clearFromRegistry)
{
RemoveController(controller);
activeControllers.Remove(interactionSourceState.source.id);
}
}
Expand Down

0 comments on commit 3ca952d

Please sign in to comment.