Skip to content

Update HandMeshController.cs #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Assets/Banner.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Assets/iconBG.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Assets/iconFG.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this package adheres to
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.9.1] - 2025-04-03

### Added
* New Sample **XRController** which syncs and displays Samsung Controller

### Changed
* N/A

### Deprecated
* N/A

### Removed
* N/A

### Fixed
* Updated Android XR permissions.

## [0.9.0] - 2024-12-12

This is the first release of **Android XR Extensions for Unity
Expand Down
46 changes: 38 additions & 8 deletions Editor/Internal/XRSessionFeatureBuildHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ internal class XRSessionFeatureBuildHooks : OpenXRFeatureBuildHooks
{ "value", "ACTIVITY_START_MODE_UNMANAGED_FULL_SPACE" }
}
};
private static readonly ManifestElement _libopenxrso =
new ManifestElement()
{
ElementPath = new List<string>
{
"manifest", "application", "uses-native-library"
},
Attributes = new Dictionary<string, string>
{
{ "name", "libopenxr.google.so" },
{ "required", "false" }
}
};
#endif // XR_MGMT_4_4_0_OR_NEWER

/// <inheritdoc/>
Expand Down Expand Up @@ -172,20 +185,28 @@ public override ManifestRequirement ProvideManifestRequirement()
Debug.Log(stringBuilder);
}

if (CheckSceneUnderstandingPermission())
if (CheckSceneUnderstandingCoarsePermission())
{
requiredManifest.Add(
GetAndroidXRPermissionElement(AndroidXRPermission.SceneUnderstanding));
GetAndroidXRPermissionElement(AndroidXRPermission.SceneUnderstandingCoarse));
Debug.LogFormat("Inject permission manifest: {0}",
AndroidXRPermission.SceneUnderstanding.ToPermissionString());
AndroidXRPermission.SceneUnderstandingCoarse.ToPermissionString());
}

if (CheckEyeTrackingPermission())
if (CheckSceneUnderstandingFinePermission())
{
requiredManifest.Add(
GetAndroidXRPermissionElement(AndroidXRPermission.EyeTracking));
GetAndroidXRPermissionElement(AndroidXRPermission.SceneUnderstandingFine));
Debug.LogFormat("Inject permission manifest: {0}",
AndroidXRPermission.EyeTracking.ToPermissionString());
AndroidXRPermission.SceneUnderstandingFine.ToPermissionString());
}

if (CheckEyeTrackingCoarsePermission())
{
requiredManifest.Add(
GetAndroidXRPermissionElement(AndroidXRPermission.EyeTrackingCoarse));
Debug.LogFormat("Inject permission manifest: {0}",
AndroidXRPermission.EyeTrackingCoarse.ToPermissionString());
}

if (CheckEyeTrackingFinePermission())
Expand All @@ -204,6 +225,9 @@ public override ManifestRequirement ProvideManifestRequirement()
AndroidXRPermission.HandTracking.ToPermissionString());
}

requiredManifest.Add(_libopenxrso);
Debug.LogFormat("Inject native library manifest: libopenxr.google.so");

List<ManifestElement> emptyElement = new List<ManifestElement>();
return new ManifestRequirement
{
Expand All @@ -230,7 +254,7 @@ private static ManifestElement GetAndroidXRPermissionElement(AndroidXRPermission
};
}

private bool CheckSceneUnderstandingPermission()
private bool CheckSceneUnderstandingCoarsePermission()
{
XRTrackableFeature trackableFeature =
AndroidXRBuildUtils.GetActiveFeature<XRTrackableFeature>();
Expand Down Expand Up @@ -265,7 +289,13 @@ private bool CheckSceneUnderstandingPermission()
(anchorFeature != null && anchorFeature.enabled);
}

private bool CheckEyeTrackingPermission()
private bool CheckSceneUnderstandingFinePermission()
{
/// Add check for scene understanding when implemented.
return false;
}

private bool CheckEyeTrackingCoarsePermission()
{
FoveatedRenderingFeature foveatedRendering =
AndroidXRBuildUtils.GetActiveFeature<FoveatedRenderingFeature>();
Expand Down
26 changes: 17 additions & 9 deletions Runtime/AndroidXRPermissionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,29 @@ namespace Google.XR.Extensions
public enum AndroidXRPermission
{
/// <summary>
/// Permission to enable scene understanding features that relies on motion tracking,
/// Permission to enable coarse scene understanding features that relies on motion tracking,
/// ToF sensor, and the VST RGB-left cameras.
/// </summary>
SceneUnderstanding,
SceneUnderstandingCoarse,

/// <summary>
/// Permission to enable fine scene understanding features that relies on motion tracking,
/// such as depth texture and scene meshing.
/// </summary>
SceneUnderstandingFine,

/// <summary>
/// Permission to enable hand tracking.
/// </summary>
HandTracking,

/// <summary>
/// Permission to enable eye tracking.
/// Permission to enable coarse eye tracking.
/// </summary>
EyeTracking,
EyeTrackingCoarse,

/// <summary>
/// Permission to enable eye gaze interaction.
/// Permission to enable eye gaze interaction and fine eye tracking.
/// </summary>
EyeTrackingFine,

Expand All @@ -68,12 +74,14 @@ public static string ToPermissionString(this AndroidXRPermission permission)
{
switch (permission)
{
case AndroidXRPermission.SceneUnderstanding:
return "android.permission.SCENE_UNDERSTANDING";
case AndroidXRPermission.SceneUnderstandingCoarse:
return "android.permission.SCENE_UNDERSTANDING_COARSE";
case AndroidXRPermission.SceneUnderstandingFine:
return "android.permission.SCENE_UNDERSTANDING_FINE";
case AndroidXRPermission.HandTracking:
return "android.permission.HAND_TRACKING";
case AndroidXRPermission.EyeTracking:
return "android.permission.EYE_TRACKING";
case AndroidXRPermission.EyeTrackingCoarse:
return "android.permission.EYE_TRACKING_COARSE";
case AndroidXRPermission.EyeTrackingFine:
return "android.permission.EYE_TRACKING_FINE";
case AndroidXRPermission.FaceTracking:
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Features/XRAnchorFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public class XRAnchorFeature : OpenXRFeature
/// Runtime permission required to enable scene understanding.
/// </summary>
public static readonly AndroidXRPermission RequiredPermission =
AndroidXRPermission.SceneUnderstanding;
AndroidXRPermission.SceneUnderstandingCoarse;

internal static bool? _extensionEnabled = null;

Expand Down
2 changes: 1 addition & 1 deletion Runtime/Features/XRObjectTrackingFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class XRObjectTrackingFeature : OpenXRFeature
/// Runtime permission required to enable scene understanding.
/// </summary>
public static readonly AndroidXRPermission RequiredPermission =
AndroidXRPermission.SceneUnderstanding;
AndroidXRPermission.SceneUnderstandingCoarse;

internal static bool? _extensionEnabled = null;

Expand Down
2 changes: 1 addition & 1 deletion Runtime/Features/XRTrackableFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class XRTrackableFeature : OpenXRFeature
/// Runtime permission required to enable scene understanding.
/// </summary>
public static readonly AndroidXRPermission RequiredPermission =
AndroidXRPermission.SceneUnderstanding;
AndroidXRPermission.SceneUnderstandingCoarse;

internal static bool? _extensionEnabled = null;

Expand Down
Binary file modified Runtime/Plugins/openxr_android.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion Samples~/FaceTracking/FaceTracking.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 020be0254b2eb4423832ec90c82d8a62, type: 3}
m_Name:
m_EditorClassIdentifier:
AndroidXRPermissions: 04000000
AndroidXRPermissions: 05000000
GenernalAndroidPermissions: []
PermissionRationale: Required for face tracking.
--- !u!1001 &1351983703979631387
Expand Down
2 changes: 1 addition & 1 deletion Samples~/HandMesh/HandMeshController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void Start()
if (meshSubsystems.Count != 1)
{
Debug.LogError("Unexpected number of mesh subsystems."
+ "Expected 1, got {meshSubsystems.Count}.");
+ $"Expected 1, got {meshSubsystems.Count}.");
enabled = false;
return;
}
Expand Down
48 changes: 24 additions & 24 deletions Samples~/XRController/Prefab/LeftController.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,20 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 49ad92e74cacea040be7c224f4f331c3, type: 3}
m_Name:
m_EditorClassIdentifier:
thumbStick: {fileID: 6560750023782525230}
upperButton: {fileID: 3294422559947940247}
lowerButton: {fileID: 3338177163201177434}
systemButton: {fileID: 3535638649786920005}
trigger: {fileID: 8090141865140552173}
grip: {fileID: 762857701643272421}
maxThumbStickRot: {x: 10, y: 10}
pressedThumbStickOffset: 0.002
pressedUpperBtnOffset: 0.002
pressedLowerBtnOffset: 0.002
pressedSystemBtnOffset: 0.001
maxTriggerRot: 17
maxGripRot: 10
thumbStickInput:
_thumbStick: {fileID: 6560750023782525230}
_upperButton: {fileID: 3294422559947940247}
_lowerButton: {fileID: 3338177163201177434}
_systemButton: {fileID: 3535638649786920005}
_trigger: {fileID: 8090141865140552173}
_grip: {fileID: 762857701643272421}
_maxThumbStickRot: {x: 10, y: 10}
_pressedThumbStickOffset: 0.002
_pressedUpperBtnOffset: 0.002
_pressedLowerBtnOffset: 0.002
_pressedSystemBtnOffset: 0.001
_maxTriggerRot: 17
_maxGripRot: 10
_thumbStickInput:
m_Name: Thumb Stick Input
m_Type: 0
m_ExpectedControlType: Vector2
Expand All @@ -170,7 +170,7 @@ MonoBehaviour:
m_Action: Thumb Stick Input
m_Flags: 0
m_Flags: 0
thumbStickPressedInput:
_thumbStickPressedInput:
m_Name: Thumb Stick Pressed Input
m_Type: 1
m_ExpectedControlType: Button
Expand All @@ -187,7 +187,7 @@ MonoBehaviour:
m_Action: Thumb Stick Pressed Input
m_Flags: 0
m_Flags: 0
upperButtonPressedInput:
_upperButtonPressedInput:
m_Name: Upper Button Pressed Input
m_Type: 1
m_ExpectedControlType: Button
Expand All @@ -204,7 +204,7 @@ MonoBehaviour:
m_Action: Upper Button Pressed Input
m_Flags: 0
m_Flags: 0
lowerButtonPressedInput:
_lowerButtonPressedInput:
m_Name: Lower Button Pressed Input
m_Type: 1
m_ExpectedControlType: Button
Expand All @@ -221,7 +221,7 @@ MonoBehaviour:
m_Action: Lower Button Pressed Input
m_Flags: 0
m_Flags: 0
systemButtonPressedInput:
_systemButtonPressedInput:
m_Name: System Button Pressed Input
m_Type: 1
m_ExpectedControlType: Button
Expand All @@ -238,7 +238,7 @@ MonoBehaviour:
m_Action: System Button Pressed Input
m_Flags: 0
m_Flags: 0
triggerInput:
_triggerInput:
m_Name: Trigger Input
m_Type: 0
m_ExpectedControlType:
Expand All @@ -255,7 +255,7 @@ MonoBehaviour:
m_Action: Trigger Input
m_Flags: 0
m_Flags: 0
gripInput:
_gripInput:
m_Name: Grip Input
m_Type: 0
m_ExpectedControlType:
Expand All @@ -272,10 +272,10 @@ MonoBehaviour:
m_Action: Grip Input
m_Flags: 0
m_Flags: 0
inverseThumbStickX: 1
inverseThumbStickY: 1
gripRotationPivot: {x: 0, y: 0, z: 1}
triggerRotationPivot: {x: 1, y: 0, z: 0}
_inverseThumbStickX: 1
_inverseThumbStickY: 1
_gripRotationPivot: {x: 0, y: 0, z: 1}
_triggerRotationPivot: {x: 1, y: 0, z: 0}
--- !u!114 &106320436904039793
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
Loading