Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Add support for input and gestures for hand controllers (#164)
Browse files Browse the repository at this point in the history
* Move SDK asm definition to correct plact

* Fix recorded poses assets

* Fix simulation profiles

* Assign default tracked poses

* Copy over SDK changes

* fixed visualization references

* Undo GUID change

* Restore recorded hand pose JSON assets lost by merge

* Fix NRE for spatial pointer mapping

* Re-init simulated hand defaults

* Remove open steady pose

* Update hand pointer profile

* Update defaults for runtime hands

* Moved WMR hand data provider profile to WMR module

* Reduce profile redundancy a bit

* Fix visualized joint rotations

* Moved simulated hand data provider profile

* Moved WMR profile to WMR module

* Update profiles

* Updated profiles

* changes for near pointer interactions using collision

* removed unused reference

* Update BaseControllerPointerInspector.cs (#175)

* Update index finger pose mapping for hands

* Use triggers instead of physics colliders

* Update BaseControllerPointer.cs

* Create hand near poniter prefab (temp?)

* only raise pointer events if we have a valid pointer target

* revert

* Delete surface touch prefab

* Create near pointer prefab variant

* Introduce hand rendering mode

* Implement visuailzation runtime switch and update prefabs

* Fix none rendering mode

* Fix existing joints not enabled on enable

* Update prefabs

* Remove redundant check

* Create custom pointer prefab for hands

* Implement runtime physics toggle

* Implement runtime bounds mode selection

* Fix visuailzation script guid reference

* Reduce hand mass

* Set hand weight to average human hand weight

* Update assets

* Update IsNearPointerIdle computed property

* Implement spatial pointer transform

* Update pointer mesh

* Use local position only for joint poses

* Add debug utility to record hand data

* Goodbye NONE joint

* Rename joints

* Update default hand interactions

* Sync simulation profiles

* reserialized json data to exclude reference types (#192)

Fixed build errors from hand data recorder
updated log for near pointer

* Fix NRE in case tip prefab does not have a renderer

* updated spatial pointer from update loop to use input changed event (#193)

removed commented out stuff from near pointer
removed empty near pointer inspector
updated pointer inspectors to fallback if no inspector is made for derived types

* override interaction modes for hand near/spatial pointers

* updated prefab serialization

* Bake default poses

* Add tracked hand pose input action

* Update baked data for hand poses

* Fix spatial pointer disabled while interacting

* Fix spatial pointer line renderer start offset

* Fix rotation not set in local space

* Adjust spatial pointer mesh renderer settings

* Only update hand visusalization if hand is tracked

* Optimize foreach loop to for loop

* Get mesh data using TryGetHandMeshData

* Remove HandData input event

* Fix physics companion pose not updated

* Remove tracked pose raw input action

* Fix hand controller profiles default mappings

* Set graphics quality to highest for vr devices

* Fix interaction mappings for hand controllers

* Fix near pointer target not updated

* Temporarily change hand prefabs for better debugging

* Make colliders dict readonly

* Remove debug hand visualization

Co-authored-by: Stephen Hodgson <hodgson.designs@gmail.com>
  • Loading branch information
FejZa and StephenHodgson committed Sep 22, 2020
1 parent 3b2c998 commit 0440bd2
Show file tree
Hide file tree
Showing 133 changed files with 6,010 additions and 1,979 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace XRTK.SDK.Editor.Input.Handlers
{
[CustomEditor(typeof(ControllerPoseSynchronizer))]
[CustomEditor(typeof(ControllerPoseSynchronizer), true, isFallback = true)]
public class ControllerPoseSynchronizerInspector : UnityEditor.Editor
{
private static readonly GUIContent SynchronizationSettings = new GUIContent("Synchronization Settings");
Expand Down
2 changes: 1 addition & 1 deletion Editor/UX/Pointers/BaseControllerPointerInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace XRTK.SDK.Editor.UX.Pointers
{
[CustomEditor(typeof(BaseControllerPointer))]
[CustomEditor(typeof(BaseControllerPointer), true, isFallback = true)]
public class BaseControllerPointerInspector : ControllerPoseSynchronizerInspector
{
private readonly GUIContent basePointerFoldoutHeader = new GUIContent("Base Pointer Settings");
Expand Down
49 changes: 49 additions & 0 deletions Editor/UX/Pointers/HandSpatialPointerInspector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright (c) XRTK. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using UnityEditor;
using UnityEngine;
using XRTK.Editor.Extensions;
using XRTK.SDK.UX.Pointers;

namespace XRTK.SDK.Editor.UX.Pointers
{
[CustomEditor(typeof(HandSpatialPointer))]
public class HandSpatialPointerInspector : LinePointerInspector
{
private SerializedProperty pointerPoseTransform;
private SerializedProperty offsetStart;
private SerializedProperty offsetEnd;
private static readonly GUIContent foldoutHeader = new GUIContent("Spatial Pointer Settings");

protected override void OnEnable()
{
base.OnEnable();

pointerPoseTransform = serializedObject.FindProperty(nameof(pointerPoseTransform));
offsetStart = serializedObject.FindProperty(nameof(offsetStart));
offsetEnd = serializedObject.FindProperty(nameof(offsetEnd));
}

public override void OnInspectorGUI()
{
base.OnInspectorGUI();

serializedObject.Update();

pointerPoseTransform.isExpanded = EditorGUILayoutExtensions.FoldoutWithBoldLabel(pointerPoseTransform.isExpanded, foldoutHeader);
if (pointerPoseTransform.isExpanded)
{
EditorGUI.indentLevel++;

EditorGUILayout.PropertyField(pointerPoseTransform);
EditorGUILayout.PropertyField(offsetStart);
EditorGUILayout.PropertyField(offsetEnd);

EditorGUI.indentLevel--;
}

serializedObject.ApplyModifiedProperties();
}
}
}
11 changes: 11 additions & 0 deletions Editor/UX/Pointers/HandSpatialPointerInspector.cs.meta

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

2 changes: 1 addition & 1 deletion Editor/UX/Pointers/LinePointerInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace XRTK.SDK.Editor.UX.Pointers
{
[CustomEditor(typeof(LinePointer))]
[CustomEditor(typeof(LinePointer), true, isFallback = true)]
public class LinePointerInspector : BaseControllerPointerInspector
{
private const int MAX_RECOMMENDED_LINECAST_RESOLUTION = 20;
Expand Down
57 changes: 57 additions & 0 deletions Prefabs~/UX/Hands/DefaultLeftHandControllerVisualizer.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7398244499265140811
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1355368130211572882}
- component: {fileID: 3076132558849983539}
m_Layer: 0
m_Name: DefaultLeftHandControllerVisualizer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1355368130211572882
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7398244499265140811}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3076132558849983539
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7398244499265140811}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: aaa953e22a23b764ebaedb977c249dfd, type: 3}
m_Name:
m_EditorClassIdentifier:
handedness: 1
destroyOnSourceLost: 1
useSourcePoseData: 1
poseAction:
profileGuid: 00000000000000000000000000000000
id: 0
description: None
axisConstraint: 0
jointsModePrefab: {fileID: 9173983480249558903, guid: 081f7848cfd94b34f9c774490cd7e2fb,
type: 3}
meshModePrefab: {fileID: 1887883006053652, guid: 12df5e0d0c33a444a985de4e29533a24,
type: 3}

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

63 changes: 63 additions & 0 deletions Prefabs~/UX/Hands/DefaultRightHandControllerVisualizer.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &888890962389326207
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 7398244499265140811, guid: 61feeca21178ba54682d3c61ff5f89a1,
type: 3}
propertyPath: m_Name
value: DefaultRightHandControllerVisualizer
objectReference: {fileID: 0}
- target: {fileID: 1355368130211572882, guid: 61feeca21178ba54682d3c61ff5f89a1,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1355368130211572882, guid: 61feeca21178ba54682d3c61ff5f89a1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1355368130211572882, guid: 61feeca21178ba54682d3c61ff5f89a1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1355368130211572882, guid: 61feeca21178ba54682d3c61ff5f89a1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3076132558849983539, guid: 61feeca21178ba54682d3c61ff5f89a1,
type: 3}
propertyPath: handedness
value: 2
objectReference: {fileID: 0}
- target: {fileID: 3076132558849983539, guid: 61feeca21178ba54682d3c61ff5f89a1,
type: 3}
propertyPath: jointsModePrefab
value:
objectReference: {fileID: 359003569130992022, guid: 1d9336d86c602194bb2bd581c9389ce7,
type: 3}
- target: {fileID: 3076132558849983539, guid: 61feeca21178ba54682d3c61ff5f89a1,
type: 3}
propertyPath: meshModePrefab
value:
objectReference: {fileID: 3866922547383302811, guid: ea935581bf93125478b7586a9a3c3f76,
type: 3}
- target: {fileID: 4191434239757458300, guid: 61feeca21178ba54682d3c61ff5f89a1,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2089245550809874106, guid: 61feeca21178ba54682d3c61ff5f89a1,
type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 61feeca21178ba54682d3c61ff5f89a1, type: 3}

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

Loading

0 comments on commit 0440bd2

Please sign in to comment.