This repository has been archived by the owner on Aug 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Missing updates required in Core for Oculus module (#237)
* Missing updates required in Core for Oculus module * Bumped version * Removed extra line
- Loading branch information
1 parent
69bdb6b
commit f6a7bed
Showing
5 changed files
with
155 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
XRTK-Core/Packages/com.xrtk.core/Extensions/InteractionMappingsExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright (c) XRTK. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using XRTK.Definitions.Devices; | ||
using XRTK.Definitions.Utilities; | ||
using XRTK.Interfaces.InputSystem; | ||
using XRTK.Services; | ||
|
||
namespace XRTK.Extensions | ||
{ | ||
/// <summary> | ||
/// Extensions for the InteractionMapping class to refactor the generic methods used for raising events in InteractionMappings. | ||
/// </summary> | ||
public static class InteractionMappingsExtensions | ||
{ | ||
public static void UpdateInteractionMappingBool(this MixedRealityInteractionMapping interactionMapping, IMixedRealityInputSource inputSource, Handedness controllerHandedness) | ||
{ | ||
// If our value changed raise it. | ||
if (interactionMapping.Changed) | ||
{ | ||
// Raise input system Event if it enabled | ||
if (interactionMapping.BoolData) | ||
{ | ||
MixedRealityToolkit.InputSystem?.RaiseOnInputDown(inputSource, controllerHandedness, interactionMapping.MixedRealityInputAction); | ||
} | ||
else | ||
{ | ||
MixedRealityToolkit.InputSystem?.RaiseOnInputUp(inputSource, controllerHandedness, interactionMapping.MixedRealityInputAction); | ||
} | ||
} | ||
|
||
if (interactionMapping.Updated) | ||
{ | ||
MixedRealityToolkit.InputSystem?.RaiseOnInputPressed(inputSource, controllerHandedness, interactionMapping.MixedRealityInputAction); | ||
} | ||
} | ||
|
||
public static void UpdateInteractionMappingFloat(this MixedRealityInteractionMapping interactionMapping, IMixedRealityInputSource inputSource, Handedness controllerHandedness) | ||
{ | ||
// If our value changed raise it. | ||
if (interactionMapping.Updated) | ||
{ | ||
// Raise input system Event if it enabled | ||
MixedRealityToolkit.InputSystem?.RaiseOnInputPressed(inputSource, controllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.FloatData); | ||
} | ||
} | ||
|
||
public static void UpdateInteractionMappingVector2(this MixedRealityInteractionMapping interactionMapping, IMixedRealityInputSource inputSource, Handedness controllerHandedness) | ||
{ | ||
// If our value changed raise it. | ||
if (interactionMapping.Updated) | ||
{ | ||
// Raise input system Event if it enabled | ||
MixedRealityToolkit.InputSystem?.RaisePositionInputChanged(inputSource, controllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.Vector2Data); | ||
} | ||
} | ||
|
||
public static void UpdateInteractionMappingPose(this MixedRealityInteractionMapping interactionMapping, IMixedRealityInputSource inputSource, Handedness controllerHandedness) | ||
{ | ||
// If our value changed raise it. | ||
if (interactionMapping.Updated) | ||
{ | ||
// Raise input system Event if it enabled | ||
MixedRealityToolkit.InputSystem?.RaisePoseInputChanged(inputSource, controllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.PoseData); | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
XRTK-Core/Packages/com.xrtk.core/Extensions/InteractionMappingsExtensions.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters