Skip to content

Commit 0758ab6

Browse files
authored
Merge pull request #117 from De-Panther/controller_check_onenable
Added isControllerActive and isHandActive to WebXRController
2 parents 8eac333 + bdb70ef commit 0758ab6

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

Packages/webxr-interactions/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88
### Added
99
- Check if hand joints radius changed on hand update in ControllerInteraction.
10+
- Check if isControllerActive and isHandActive on enable in ControllerInteraction.
1011

1112
## [0.5.2] - 2020-01-16
1213
### Fixed

Packages/webxr-interactions/Runtime/Scripts/ControllerInteraction.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ private void Awake()
6969

7070
private void OnEnable()
7171
{
72+
if (controller.isHandActive)
73+
{
74+
SetHandJointsVisible(true);
75+
}
76+
else if (controller.isControllerActive)
77+
{
78+
SetControllerVisible(true);
79+
}
7280
controller.OnControllerActive += SetControllerVisible;
7381
controller.OnHandActive += SetHandJointsVisible;
7482
controller.OnHandUpdate += OnHandUpdate;

Packages/webxr/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
### Added
99
- GetLocalRotation and GetLocalPosition to WebXRCamera.
1010
- Support for the new/updated WebXR Hands API.
11+
- isControllerActive and isHandActive to WebXRController.
1112

1213
### Changed
1314
- Using `frame.fillPoses` and `frame.fillJointRadii` instead of `frame.getJointPose` for XRHand.

Packages/webxr/Runtime/Scripts/WebXRController.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,22 @@ public enum Axis2DTypes
5757

5858
private string[] profiles = null;
5959

60+
public bool isControllerActive
61+
{
62+
get
63+
{
64+
return controllerActive;
65+
}
66+
}
67+
68+
public bool isHandActive
69+
{
70+
get
71+
{
72+
return handActive;
73+
}
74+
}
75+
6076
#if UNITY_EDITOR || !UNITY_WEBGL
6177
private InputDeviceCharacteristics xrHand = InputDeviceCharacteristics.Controller;
6278
private InputDevice? inputDevice;

0 commit comments

Comments
 (0)