Skip to content

Commit

Permalink
Fix Tracker orientation
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackebein committed Jul 29, 2024
1 parent 74ba89a commit 98e63eb
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 21 deletions.
Binary file modified Packages/dev.hackebein.object-tracking/Prefab/HTC Vive 2.0.fbx
Binary file not shown.
Binary file modified Packages/dev.hackebein.object-tracking/Prefab/HTC Vive 3.0.fbx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions Packages/dev.hackebein.object-tracking/Runtime/Setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ public void Create()
// Object for scaling and z-offset
GameObject scaleGameObject = Utility.FindOrCreateEmptyGameObject("ObjectTracking", rootGameObject);
Utility.ResetGameObject(scaleGameObject);

// TODO: check if this needs to be applied before or after scaling.
scaleGameObject.transform.localPosition = new Vector3(0, 0, zOffset);

// Objects for tracking
foreach (SetupTracker tracker in trackers)
Expand All @@ -185,6 +182,9 @@ public void Create()

// Set scale
scaleGameObject.transform.localScale = new Vector3(scale, scale, scale);

// TODO: check if this needs to be applied before or after scaling.
scaleGameObject.transform.localPosition = new Vector3(0, 0, zOffset);

// Animation Controller
CreateProcessingLayer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,10 @@ public GameObject AppendObjects(GameObject parent)
if (path != null)
{
Utility.RemoveGameObjects(Utility.TrackerTypeText[trackerType.GetHashCode()], r);
GameObject gameObject = Object.Instantiate(AssetDatabase.LoadAssetAtPath<GameObject>(path), new Vector3(0, 0, 0), Utility.TrackerTypeQuaternion[trackerType.GetHashCode()], r.transform);
GameObject gameObject = Object.Instantiate(AssetDatabase.LoadAssetAtPath<GameObject>(path), new Vector3(0, 0, 0), Quaternion.identity, r.transform);
gameObject.name = Utility.TrackerTypeText[trackerType.GetHashCode()];
gameObject.tag = "EditorOnly";
// needs to be y because all objects are x rotated by 270°
// need to be z-1 after correction all objects
gameObject.transform.localScale = new Vector3(1f, -1f, 1f);
gameObject.transform.localScale = new Vector3(1f, 1f, -1f);
}
else if (trackerType != Utility.TrackerType.None)
{
Expand Down
14 changes: 0 additions & 14 deletions Packages/dev.hackebein.object-tracking/Runtime/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,6 @@ public enum TrackerType
"Packages/dev.hackebein.object-tracking/Prefab/Tundra Labs Tundra Tracker strap.fbx",
};

public static readonly Quaternion[] TrackerTypeQuaternion =
{
Quaternion.identity,
Quaternion.identity,
Quaternion.Euler(270, 0, 0),
Quaternion.Euler(270, 0, 0),
Quaternion.Euler(270, 0, 0),
Quaternion.identity,
Quaternion.identity,
Quaternion.Euler(270, 0, 0),
Quaternion.Euler(270, 0, 0),
Quaternion.Euler(270, 0, 0),
};

public static AnimatorControllerParameter CreateBoolAnimatorParameter(string name, bool value = false)
{
AnimatorControllerParameter parameter = new AnimatorControllerParameter
Expand Down

0 comments on commit 98e63eb

Please sign in to comment.