Skip to content

Commit

Permalink
feat(handSetup): Automatic hand setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgejgnz committed Oct 2, 2020
1 parent 4cf61c8 commit 66259c2
Show file tree
Hide file tree
Showing 19 changed files with 1,031 additions and 8 deletions.
908 changes: 908 additions & 0 deletions Runtime/Components/AutomaticHandSetup.cs

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions Runtime/Components/AutomaticHandSetup.cs.meta

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

77 changes: 77 additions & 0 deletions Runtime/Helpers/BasicHelpers.cs
@@ -0,0 +1,77 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;


namespace HPTK.Helpers
{
public static class BasicHelpers
{
public static void SetLocalRotForHierarchy(Transform t, Vector3 newLocalRot)
{
t.localRotation = Quaternion.Euler(newLocalRot);
for (int i = 0; i < t.childCount; i++)
{
SetLocalRotForHierarchy(t.GetChild(i), newLocalRot);
}
}

public static bool IsCleanBranch(Transform t)
{
if (t.childCount > 1)
return false;
else if (t.childCount == 0)
return true;
else
return IsCleanBranch(t.GetChild(0));
}

public static GameObject InstantiateEmptyChild(GameObject parent)
{
GameObject newObj = new GameObject();
newObj.transform.parent = parent.transform;
newObj.transform.localPosition = Vector3.zero;
newObj.transform.localRotation = Quaternion.identity;

return newObj;
}

public static Vector3 FurthestPoint(Vector3 from, Vector3[] points)
{
Vector3 furthestPoint = from;
float maxDistance = 0.0f;
float d;
for (int i = 0; i < points.Length; i++)
{
d = Vector3.Distance(from, points[i]);

if (d > maxDistance)
{
maxDistance = d;
furthestPoint = points[i];
}
}

return furthestPoint;
}

public static Vector3 ClosestPoint(Vector3 to, Vector3[] points)
{
Vector3 closestPoint = to;
float minDistance = Mathf.Infinity;
float d;
for (int i = 0; i < points.Length; i++)
{
d = Vector3.Distance(to, points[i]);

if (d < minDistance)
{
minDistance = d;
closestPoint = points[i];
}
}

return closestPoint;
}
}
}
11 changes: 11 additions & 0 deletions Runtime/Helpers/BasicHelpers.cs.meta

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

Binary file modified Samples/Materials/Generic/Alpha_Blue.mat
Binary file not shown.
Binary file modified Samples/Materials/Generic/Mate_LightGrey.mat
Binary file not shown.
Binary file modified Samples/Materials/Generic/Mate_White.mat
Binary file not shown.
Binary file modified Samples/Materials/Generic/Mate_Yellow.mat
Binary file not shown.
Binary file modified Samples/Materials/Generic/Unlit_Black.mat
Binary file not shown.
Binary file modified Samples/Materials/Generic/Unlit_White.mat
Binary file not shown.
Binary file modified Samples/Prefabs/Avatars/Dummy.prefab
Binary file not shown.
Binary file modified Samples/Prefabs/Avatars/SpAvatar.prefab
Binary file not shown.
8 changes: 8 additions & 0 deletions Samples/Prefabs/HandSetups.meta

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

Binary file added Samples/Prefabs/HandSetups/OculusHand_L.prefab
Binary file not shown.

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

Binary file added Samples/Prefabs/HandSetups/OculusHand_R.prefab
Binary file not shown.
7 changes: 7 additions & 0 deletions Samples/Prefabs/HandSetups/OculusHand_R.prefab.meta

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

13 changes: 7 additions & 6 deletions Third-Party Notices.md
Expand Up @@ -3,12 +3,13 @@ This package is under MIT license; however, the following components are governe
./Samples/Models/OculusHand_L.fbx
./Samples/Models/OculusHand_R.fbx

[Oculus Master SDK License Agreement - 1.0]
[Oculus Master SDK License Agreement - 1.0]

Effective date: 6/1/2020
Copyright © Facebook Technologies, LLC and its affiliates. All rights reserved.
Effective date: 6/1/2020
Copyright © Facebook Technologies, LLC and its affiliates. All rights reserved.

The text of this may be found at: https://developer.oculus.com/licenses/oculusmastersdk-1.0/
The text of this may be found at: https://developer.oculus.com/licenses/oculusmastersdk-1.0/

A copy of this text may be found at:
./Samples/Models/LICENSE.txt
A copy of this text may be found at:
./Samples/Models/LICENSE.txt

Empty file removed changelog.txt
Empty file.

0 comments on commit 66259c2

Please sign in to comment.