Skip to content

Commit

Permalink
changelog, packages and patch applied
Browse files Browse the repository at this point in the history
  • Loading branch information
BryceNewell-UL committed Mar 31, 2023
1 parent fde8bd1 commit 6b690cc
Show file tree
Hide file tree
Showing 17 changed files with 78 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private void WarningsSection()
EditorGUILayout.EndHorizontal();
}
// Gravity
if(Physics.gravity.y < RECOMMENDED_GRAVITY)
if (Physics.gravity.y < RECOMMENDED_GRAVITY)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.HelpBox($"Project gravity forces are lower than {RECOMMENDED_GRAVITY} ({Physics.gravity.y}). " +
Expand All @@ -156,7 +156,7 @@ private void WarningsSection()
}
EditorGUILayout.EndHorizontal();
}
if(Physics.sleepThreshold > RECOMMENDED_SLEEP_THRESHOLD)
if (Physics.sleepThreshold > RECOMMENDED_SLEEP_THRESHOLD)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.HelpBox($"Project physics sleep threshold is larger than {RECOMMENDED_SLEEP_THRESHOLD} ({Physics.sleepThreshold}). " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public void UpdateHand(Leap.Hand hand)
// Happens after the physics simulation
private IEnumerator LateFixedUpdate()
{
for(; ; )
for (; ; )
{
for (int fingerIndex = 0; fingerIndex < Hand.FINGERS; fingerIndex++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ private void FixedFrameProcess()
private IEnumerator LateFixedFrameProcess()
{
yield return null;
for(; ; )
for (; ; )
{
if (_enableHelpers)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public PointerStates AggregatePointerState
public bool IsUserInteractingDirectly
{
get
{
{
switch (module?.InteractionMode)
{
case InteractionCapability.Both:
Expand Down Expand Up @@ -206,7 +206,7 @@ private bool NoLongerInteracting(Hand hand)
switch (module?.InteractionMode)
{
case InteractionCapability.Both:
return (PrevTriggeringInteraction && (!IsTriggeringInteraction(hand) ||
return (PrevTriggeringInteraction && (!IsTriggeringInteraction(hand) ||
(PointerStateTactile == PointerStates.OffCanvas && PointerStateProjective == PointerStates.OffCanvas)));

case InteractionCapability.Direct:
Expand Down Expand Up @@ -504,7 +504,7 @@ private void ProcessUnityEvents_HandleRaycast(Hand hand)
CurrentGameObject = CurrentGameObjectUnderPointer;

//See if this object, or one of its parents, has a pointerDownHandler
var gameObjectJustPressed = ExecuteEvents.ExecuteHierarchy(CurrentGameObject, EventData,
var gameObjectJustPressed = ExecuteEvents.ExecuteHierarchy(CurrentGameObject, EventData,
ExecuteEvents.pointerDownHandler);

//If not, see if one has a pointerClickHandler!
Expand Down Expand Up @@ -841,11 +841,11 @@ private void RaiseEventsForStateChanges(PointerStates pointerState, PointerState
}
}
}

if (StateChangeActionMap.TryGetValue((prevState, pointerState), out var result))
{
result.Action.Invoke(module, this);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private void OnPointerStateChanged(PointerElement element, Hand hand)
? Vector3.Lerp(initialScale, initialScale * interactionPointerScale, hand.PinchStrength)
: Vector3.one;

switch (element.AggregatePointerState)
switch (element.AggregatePointerState)
{
case PointerStates.OnCanvas:
spriteRenderer.color = colorBlock.normalColor;
Expand Down
4 changes: 2 additions & 2 deletions Packages/Tracking Preview/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "com.ultraleap.tracking.preview",
"version": "6.6.0",
"version": "6.7.0",
"description": "Ultraleap Tracking Preview",
"displayName": "Ultraleap Tracking Preview",
"unity": "2020.3",
"license": "Apache-2.0",
"dependencies": {
"com.ultraleap.tracking": "6.6.0",
"com.ultraleap.tracking": "6.7.0",
"com.unity.inputsystem": "1.4.4",
"com.unity.xr.interaction.toolkit": "2.0.0"
},
Expand Down
13 changes: 3 additions & 10 deletions Packages/Tracking/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

[docs-website]: https://docs.ultraleap.com/unity-api/ "Ultraleap Docs"


## [NEXT] - unreleased
## [6.7.0] - 3/4/23

### Added
- Brand new pose detection feature!
- Pose Detector (Invokes events when the chosen pose is made)
- Pose Detection Library (A library of pre-defined poses)
- Thumbs up
- Thumbs down
- OK
- Point
- Open palm up
- Open palm down
- Fist
- Horns
- Thumbs up, OK, Point, Open palm, Fist, Horns
- Pose Recorder (To record poses of your own)
- New Example Scenes
- Pose Recorder (A scene set up for you to record poses of your own)
- Pose Detection (A barebones scene to show how you can use the detector in your own scenes)
- Pose Showcase (To view and try out our new library of poses)
- Thumbs up, Thumbs down, OK, Point, Open palm up, Open palm down, Fist, Horns
- (Physics Hands) Warnings for gravity and timestep settings
- (Physics Hands) Exposed interaction mask
- (Physics Hands) Dynamically adjusting fingers when grabbing objects
Expand Down
42 changes: 20 additions & 22 deletions Packages/Tracking/Core/Editor/Scripts/HandPoseEditorScripts.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Collections.Generic;
using System.Linq;

using UnityEngine;

using UnityEditor;
using UnityEngine;

namespace Leap.Unity
{
Expand All @@ -23,7 +21,7 @@ public override void OnInspectorGUI()
EditorGUILayout.LabelField(_assetsPath, GUILayout.Width(50));
poseRecorderScript.savePath = EditorGUILayout.TextField("HandPoses/");
EditorGUILayout.EndHorizontal();

if (GUILayout.Button("Save Current Hand Pose"))
{
poseRecorderScript.SaveCurrentHandPose();
Expand Down Expand Up @@ -66,7 +64,7 @@ public override void OnInspectorGUI()
{
_showFineTuningOptions = !_showFineTuningOptions;
}

if (_showFineTuningOptions)
{
DrawDefaultInspector();
Expand Down Expand Up @@ -104,7 +102,7 @@ private void DrawJointRotationThresholds()

for (int fingerID = 0; fingerID < target.fingerJointRotationThresholds.Length; fingerID++)
{
if(!ShouldShowFinger(fingerID))
if (!ShouldShowFinger(fingerID))
{
continue;
}
Expand All @@ -128,7 +126,7 @@ private void DrawJointRotationThresholds()

target.fingerJointRotationThresholds[fingerID].jointThresholds[jointID] = new Vector2(flex, abd);
}
else if(fingerID == 0 || (fingerID != 0 && jointID != 2)) // Only present distal for thumbs
else if (fingerID == 0 || (fingerID != 0 && jointID != 2)) // Only present distal for thumbs
{
EditorGUIUtility.labelWidth = 30;

Expand All @@ -149,7 +147,7 @@ private void DrawJointRotationThresholds()

string GetJointName(int jointID)
{
switch(jointID)
switch (jointID)
{
case 0:
return "Proximal Joint";
Expand Down Expand Up @@ -304,7 +302,7 @@ public override void OnInspectorGUI()
GUILayout.Space(10);

poseDetectionScript.checkBothHands = EditorGUILayout.Toggle("Detect both hands?", poseDetectionScript.checkBothHands);

if (!poseDetectionScript.checkBothHands)
{
EditorGUILayout.PropertyField(serializedObject.FindProperty("chiralityToCheck"));
Expand Down Expand Up @@ -397,20 +395,20 @@ public override void OnInspectorGUI()
switch (direction.FindPropertyRelative("typeOfDirectionCheck").enumValueIndex)
{
case 0: //OBJECT
{
EditorGUILayout.PropertyField(direction.FindPropertyRelative("poseTarget"), new GUIContent("Object to face:"));
break;
}
{
EditorGUILayout.PropertyField(direction.FindPropertyRelative("poseTarget"), new GUIContent("Object to face:"));
break;
}
case 1: //WORLD
{
EditorGUILayout.PropertyField(direction.FindPropertyRelative("axisToFace"), new GUIContent("Axis to face:"));
break;
}
{
EditorGUILayout.PropertyField(direction.FindPropertyRelative("axisToFace"), new GUIContent("Axis to face:"));
break;
}
case 2: //CAMERALOCAL
{
EditorGUILayout.PropertyField(direction.FindPropertyRelative("axisToFace"), new GUIContent("Axis to face:"));
break;
}
{
EditorGUILayout.PropertyField(direction.FindPropertyRelative("axisToFace"), new GUIContent("Axis to face:"));
break;
}
}

EditorGUILayout.PropertyField(direction.FindPropertyRelative("rotationThreshold"), new GUIContent("Rotation threshold:"));
Expand Down Expand Up @@ -536,7 +534,7 @@ public override void OnInspectorGUI()
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();

if (GUILayout.Button("Edit Pose", GUILayout.Width(Screen.width/2), GUILayout.Height(30)))
if (GUILayout.Button("Edit Pose", GUILayout.Width(Screen.width / 2), GUILayout.Height(30)))
{
EditorGUIUtility.PingObject(target.handPose);
Selection.SetActiveObjectWithContext(target.handPose, target.handPose);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private bool CompareAllHandsAndPoses()

private bool ComparePoseToHand(HandPoseScriptableObject pose, Hand playerHand)
{

// Check any finger directions set up in the pose detector
if (poseRules.Count > 0)
{
Expand Down Expand Up @@ -425,15 +425,15 @@ private bool CheckPoseDirection(Hand playerHand)
foreach (var rule in poseRules)
{
bool directionMatchInRule = false;
if(rule.directions.Count <= 0) // If there are no directions for this rule, skip this rule
if (rule.directions.Count <= 0) // If there are no directions for this rule, skip this rule
{
directionMatchInRule = true;
continue;
}

foreach (var direction in rule.directions)
{
if(direction.enabled == false)
if (direction.enabled == false)
{
continue;
}
Expand Down Expand Up @@ -463,40 +463,40 @@ private bool CheckPoseDirection(Hand playerHand)
switch (direction.typeOfDirectionCheck)
{
case TypeOfDirectionCheck.TowardsObject:
{
float angleToDot = direction.rotationThreshold + hysteresisToAdd;
angleToDot = 1 - (Mathf.Clamp01(angleToDot / 180) * 2);

if (GetIsFacingObject(pointPosition, direction.poseTarget.position, pointDirection, angleToDot))
{
directionMatchInRule = true;
float angleToDot = direction.rotationThreshold + hysteresisToAdd;
angleToDot = 1 - (Mathf.Clamp01(angleToDot / 180) * 2);

if (GetIsFacingObject(pointPosition, direction.poseTarget.position, pointDirection, angleToDot))
{
directionMatchInRule = true;
}
break;
}
break;
}
case TypeOfDirectionCheck.WorldDirection:
{
if (GetIsFacingDirection(pointDirection, GetAxis(direction.axisToFace), direction.rotationThreshold + hysteresisToAdd))
{
directionMatchInRule = true;
if (GetIsFacingDirection(pointDirection, GetAxis(direction.axisToFace), direction.rotationThreshold + hysteresisToAdd))
{
directionMatchInRule = true;
}
break;
}
break;
}
case TypeOfDirectionCheck.CameraDirection:
{
if (GetIsFacingDirection(pointDirection,
(Camera.main.transform.rotation.normalized * GetAxis(direction.axisToFace).normalized).normalized, direction.rotationThreshold + hysteresisToAdd))
{
directionMatchInRule = true;
if (GetIsFacingDirection(pointDirection,
(Camera.main.transform.rotation.normalized * GetAxis(direction.axisToFace).normalized).normalized, direction.rotationThreshold + hysteresisToAdd))
{
directionMatchInRule = true;
}
break;
}
break;
}
}
poseRulesForValidator.Add(new PoseRuleCache(playerHand.GetChirality(),
new Tuple<PoseRule, bool>(rule, directionMatchInRule)));
}
}

if(directionMatchInRule == false)
if (directionMatchInRule == false)
{
allRulesPassed = false;
}
Expand Down Expand Up @@ -527,7 +527,7 @@ private Vector2 GetDegreeAngleDifferenceXY(Vector3 a, Vector3 b)

private bool GetIsFacingDirection(Vector3 boneDirection, Vector3 TargetDirectionDirection, float thresholdInDegrees)
{
return(Vector3.Angle(boneDirection.normalized, TargetDirectionDirection.normalized) < thresholdInDegrees);
return (Vector3.Angle(boneDirection.normalized, TargetDirectionDirection.normalized) < thresholdInDegrees);
}

private Vector2 GetBoneRotationThreshold(HandPoseScriptableObject pose, int fingerNum, int boneNum)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public class HandPoseEditor : LeapProvider
public override Frame CurrentFrame
{
get
{
{
List<Hand> hands = new List<Hand>();
foreach(var hand in currentHandsAndPosedObjects)
foreach (var hand in currentHandsAndPosedObjects)
{
hands.Add(hand.Item1);
}
Expand Down Expand Up @@ -74,7 +74,7 @@ private void UpdateHands()
handPosition = handsLocation.position;
}

if(posedHand.IsLeft)
if (posedHand.IsLeft)
{
posedHand.SetTransform((handPosition + new Vector3(-0.15f, 0, 0)), posedHand.Rotation);
mirroredHand.SetTransform((handPosition + new Vector3(0.15f, 0, 0)), mirroredHand.Rotation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public struct FingerJointThresholds
public bool detectPinky = true;

private List<int> fingerIndexesToCheck = new List<int>();

public List<int> GetFingerIndexesToCheck()
{
ApplyFingersToUse();
Expand Down Expand Up @@ -114,7 +114,7 @@ void MirrorHand(Hand handSource)

public Vector2 GetBoneRotationthreshold(int fingerNum, int boneNum)
{
if(fingerJointRotationThresholds.Length > 0)
if (fingerJointRotationThresholds.Length > 0)
{
return fingerJointRotationThresholds[fingerNum].jointThresholds[boneNum];
}
Expand Down Expand Up @@ -144,17 +144,17 @@ public void SetAllBoneThresholds(float threshold, bool forceAll = false)
{
Vector2 newRotation = new Vector2(threshold, threshold);

for(int fingerIndex = 0; fingerIndex < fingerJointRotationThresholds.Length; fingerIndex++)
for (int fingerIndex = 0; fingerIndex < fingerJointRotationThresholds.Length; fingerIndex++)
{
if (forceAll)
{
fingerJointRotationThresholds[fingerIndex].jointThresholds = new Vector2[] { newRotation, newRotation, newRotation };
}
else
{
for(int jointIndex = 0; jointIndex < fingerJointRotationThresholds[fingerIndex].jointThresholds.Length; jointIndex++)
for (int jointIndex = 0; jointIndex < fingerJointRotationThresholds[fingerIndex].jointThresholds.Length; jointIndex++)
{
if(fingerJointRotationThresholds[fingerIndex].jointThresholds[jointIndex].x == globalRotation)
if (fingerJointRotationThresholds[fingerIndex].jointThresholds[jointIndex].x == globalRotation)
{
fingerJointRotationThresholds[fingerIndex].jointThresholds[jointIndex].x = threshold;
}
Expand Down
Loading

0 comments on commit 6b690cc

Please sign in to comment.