Skip to content
This repository was archived by the owner on Nov 16, 2024. It is now read-only.

Commit bb3215f

Browse files
Tuples (#214)
* Remove dependency on tuple from SpacePinVisualizer. * Bump patch version to 1.5.3. * Update packaging files for v1.5.3, and lower Unity dependency for core and examples to U2018.4. * Minor documentation updates (esp ASA only targets ARM64 on HL2). * Delete unused documentaton icons.
1 parent 063ce4e commit bb3215f

16 files changed

Lines changed: 56 additions & 29 deletions

File tree

Assets/WorldLocking.Core/Scripts/WorldLockingManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class WorldLockingManager
3535
/// allowing quick visual verification of the version of World Locking Tools for Unity currently installed.
3636
/// It has no effect in code, but serves only as a label.
3737
/// </summary>
38-
public static string Version => "1.5.2";
38+
public static string Version => "1.5.3";
3939

4040
/// <summary>
4141
/// The configuration settings may only be set as a block.

Assets/WorldLocking.Tools/Scripts/SpacePinMeshVisualizer.cs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,20 @@ private static Pose GetGlobalFromLocked()
149149
return globalFromLocked;
150150
}
151151

152+
private struct IndexedTriangle
153+
{
154+
public int index0;
155+
public int index1;
156+
public int index2;
157+
158+
public IndexedTriangle(int i0, int i1, int i2)
159+
{
160+
index0 = i0;
161+
index1 = i1;
162+
index2 = i2;
163+
}
164+
}
165+
152166
/// <summary>
153167
/// Generates the whole mesh inside the triangulation data, except for the boundary triangles/vertices.
154168
/// </summary>
@@ -171,7 +185,7 @@ private Mesh GenerateTriangulationWireFrameMesh()
171185

172186
wholeMesh.vertices = vertices;
173187

174-
List<(int, int, int)> trimmedTriangles = new List<(int, int, int)>();
188+
List<IndexedTriangle> trimmedTriangles = new List<IndexedTriangle>();
175189

176190
for (int i = 0; i < triangulator.Triangles.Length; i += 3)
177191
{
@@ -187,17 +201,21 @@ private Mesh GenerateTriangulationWireFrameMesh()
187201
if (currentInterpolant != null && (triangleDataSameAsClosestTriangle && !AnyWeightInTriangleZero()))
188202
continue;
189203

190-
trimmedTriangles.Add((triangulator.Triangles[i] - 4, triangulator.Triangles[i + 1] - 4, triangulator.Triangles[i + 2] - 4));
204+
trimmedTriangles.Add(new IndexedTriangle(
205+
triangulator.Triangles[i] - 4,
206+
triangulator.Triangles[i + 1] - 4,
207+
triangulator.Triangles[i + 2] - 4
208+
));
191209
}
192210

193211
int[] tris = new int[trimmedTriangles.Count * 3];
194212

195213
int triIndex = 0;
196214
for (int i = 0; i < trimmedTriangles.Count; i++)
197215
{
198-
tris[triIndex] = trimmedTriangles[i].Item1;
199-
tris[triIndex + 1] = trimmedTriangles[i].Item2;
200-
tris[triIndex + 2] = trimmedTriangles[i].Item3;
216+
tris[triIndex] = trimmedTriangles[i].index0;
217+
tris[triIndex + 1] = trimmedTriangles[i].index1;
218+
tris[triIndex + 2] = trimmedTriangles[i].index2;
201219
triIndex += 3;
202220
}
203221

DocGen/Documentation/Concepts.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@
44

55
In the day to day physical world, space is well described by a stationary coordinate system. A motionless object in a stationary coordinate system will continue having the same coordinates forever. A group of objects laid out in a specific configuration will maintain that configuration. Two objects moving with identical velocities will remain at a fixed offset from each other.
66

7-
These and similar laws are such an basic part of existence that when they no longer hold, intuition about the world becomes unreliable.
7+
These and similar laws are such an basic part of existence that when they no longer hold, intuition about the world becomes unreliable.
88

99
## Previous solutions
1010

11-
Unity's *global coordinate space* and *spatial anchors* each address different aspects of the problems caused by sensor inaccuracies and drift.
11+
Unity's *global coordinate space* and *spatial anchors* each address different aspects of the problems caused by sensor inaccuracies and drift.
1212

1313
Unity's global coordinate space provides a stable frame of reference, in which holographic objects remain fixed relative to one another. While objects in this space will behave consistently relative to each other, consistency with the physical world is not guaranteed nor generally provided. Especially when the user is moving around, inconsistencies will develop.
1414

15-
Unity's spatial anchors can maintain a hologram's position in the physical world when the user is mobile, but at the sacrifice of self consistency within the virtual world. Different anchors are constantly moving relative to one another. They are also moving through the global coordinate space, making simple tasks like layout difficult, and physics simulation problematic.
15+
Unity's spatial anchors can maintain a hologram's position in the physical world when the user is mobile, but at the sacrifice of self consistency within the virtual world. Different anchors are constantly moving relative to one another. They are also moving through the global coordinate space, making simple tasks like layout difficult, and physics simulation problematic.
1616

1717
## The source of the problem
1818

19-
Discussion here will center around HoloLens technology, but these concepts apply generally to inside out markerless tracking techniques, especially as augmented by inertial systems.
19+
Discussion here will center around HoloLens technology, but these concepts apply generally to inside out marker-less tracking techniques, especially as augmented by inertial systems.
2020

2121
The HoloLens is amazing at determining where it is relative to visible features in the surroundings. By extension, it is also amazing at positioning other virtual objects by those same visible features. So when the user is sitting or standing in a roughly constant position, the device is great at keeping virtual objects registered with visible physical reference points. A virtual cup placed on a physical table, will mostly stay in the same spot on the surface of the table.
2222

2323
That's when the HoloLens is confined to the same small volume, with a constant set of visible features in view for reference. But there are other interesting scenarios.
2424

2525
When the user gets up and moves about the room, or possibly even between rooms, the HoloLens must switch between old features leaving view and new features coming into view. Without getting into implementation details, it's clear to see that while in transit, tracking accuracy is going to be very much degraded.
2626

27-
Here's a simplistic scenario for context.
27+
Here's a simplistic scenario for context.
2828

2929
### Illustration
3030

@@ -36,17 +36,17 @@ Now looking around at point B, good visible features are recorded. Tracking and
3636

3737
When at point A, things around point A look great, and when around point B, things at point B look great. But there's an inconsistency. The 10 meters between points A and B in physical space are only 9 meters in virtual space. That's often referred to as "the scale problem", although "the distance problem" might be more accurate. Regardless, we'll get back to when that's a problem soon.
3838

39-
But first, the user walks back to point A. This time the tracking errors make the 10 meters walk from B to A in physical space add up to 10.5 meters in virtual space. And that means that the full walk from A to B to A adds up to a net move of 1.5 meters, when it should obviously be 0.0 meters. This is an obvious problem. A hologram placed at point A before the walk will now appear 1.5 meters away from point A.
39+
But first, the user walks back to point A. This time the tracking errors make the 10 meters walk from B to A in physical space add up to 10.5 meters in virtual space. And that means that the full walk from A to B to A adds up to a net move of 1.5 meters, when it should obviously be 0.0 meters. This is an obvious problem. A hologram placed at point A before the walk will now appear 1.5 meters away from point A.
4040

4141
This is where spatial anchors can help. After walking to B and back, the system recognizes that it is back at point A, yet the head's Unity coordinates have changed by 1.5 meters. But if the hologram at point A has a spatial anchor attached, the spatial anchor can think "I'm at point A, the head is at point A, but my coordinates differ from the head's by 1.5 meters. I'll just change my coordinates by 1.5 meters so that we're in agreement again." And a spatial anchor at point C, a meter to the left of the user, is going through the same process. In essence, the spatial anchor constantly redefines where point A is in Unity space so that the head's coordinates are always right. And each spatial anchor does this independently for its place in the physical world.
4242

4343
## World Locking Tools for Unity
4444

45-
World Locking Tools keeps an internal supply of spatial anchors it spreads as the user moves around. It analyses the coordinates of the camera and those spatial anchors every frame. It detects when all of those spatial anchors are moving over 1.5 meters to match the coordinates of the head, and says "Hmm, instead of changing the coordinates of everything in the world to compensate for the head having different coordinates than the last time it was here, I'll just fix the head's coordinates instead."
45+
World Locking Tools keeps an internal supply of spatial anchors it spreads as the user moves around. It analyses the coordinates of the camera and those spatial anchors every frame. It detects when all of those spatial anchors are moving over 1.5 meters to match the coordinates of the head, and says "Hmm, instead of changing the coordinates of everything in the world to compensate for the head having different coordinates than the last time it was here, I'll just fix the head's coordinates instead."
4646

4747
That means that, rather than having to have a spatial anchor drag a hologram through Unity space so that it will remain fixed in physical space, the entire Unity world space is locked to physical space. If a hologram is motionless in Unity space, it will remain motionless relative to the physical world features around it. And just as importantly, it will remain fixed relative to the virtual features around it.
4848

49-
Obviously it's more complicated under the hood than that. For example, remember that a problem with the spatial anchors is that they move independently, so don't always agree with each other. The underlying FrozenWorld engine arbitrates those disagreements to come up with the most perceptually correct camera correction, and does that every frame.
49+
Obviously it's more complicated under the hood than that. For example, remember that a problem with the spatial anchors is that they move independently, so don't always agree with each other. The underlying FrozenWorld engine arbitrates those disagreements to come up with the most perceptually correct camera correction, and does that every frame.
5050

5151
## The scale problem again
5252

@@ -58,7 +58,7 @@ This can be inconvenient in many forms, but it becomes a blocking issue when obj
5858

5959
And so far in this discussion, the minimum information required to fix the problem has not been introduced.
6060

61-
World Locking Tools addresses that problem with the [Space Pins](Concepts/Advanced/SpacePins.md) API, which allows the application to supply enough information relating the physical world and holographic world to correct for the errors in distance traveled. This allows large holograms to appear aligned with the physical world all over.
61+
World Locking Tools addresses that problem with the [Space Pins](Concepts/Advanced/SpacePins.md) API, which allows the application to supply enough information relating the physical world and holographic world to correct for the errors in distance traveled. This allows large holograms to appear aligned with the physical world all over.
6262

6363
## Next
6464

@@ -68,4 +68,4 @@ These advanced mechanisms will be covered in later sections, but it is useful to
6868

6969
* [FAQ](IntroFAQ.md)
7070
* [The basic system](Concepts/BasicConcepts.md)
71-
* [Advanced topics](Concepts/AdvancedConcepts.md)
71+
* [Advanced topics](Concepts/AdvancedConcepts.md)

DocGen/Documentation/HowTos/WLT_ASA.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ WLT supports:
1414
* Unity 2018.4, Unity 2019.4, Unity 2020.3
1515
* HoloLens, HoloLens2, Android, and iOS
1616
* Unity Legacy XR, XR SDK, or OpenXR
17-
* Azure Spatial Anchors v2.9.0-v2.10.0
17+
* Azure Spatial Anchors v2.9.0-v2.10.2
1818

19-
Use of ASA imposes these additional restrictions:
19+
Use of ASA v2.9+ imposes these additional restrictions:
2020

2121
* Unity 2020.3 or later
2222
* XR SDK or OpenXR
23+
* At the time of this writing, ASA only targets ARM64 (not ARM32) on HoloLens2. Check the latest [ASA documentation](https://docs.microsoft.com/azure/spatial-anchors/quickstarts/get-started-unity-hololens?tabs=azure-portal).
2324

2425
## Setup for using ASA with WLT
2526

-1.91 KB
Binary file not shown.
-6.46 KB
Binary file not shown.
-2.95 KB
Binary file not shown.
-1.79 KB
Binary file not shown.

UPM/asa_files/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[See release notes](https://github.com/microsoft/MixedReality-WorldLockingTools-Unity/releases)
44

5+
## 1.5.3 - Remove dependency on tuple, and add MR Feature Tool support back to Unity 2018.4.
6+
57
## 1.5.2 - Delay startup for Holographic Remoting.
68

79
## 1.5.1 - Fixes for local world locking.

UPM/asa_files/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.microsoft.mixedreality.wlt.asa",
33
"displayName": "WLT-ASA",
4-
"version": "1.5.2",
4+
"version": "1.5.3",
55
"unity": "2020.3",
66
"msftFeatureCategory": "World Locking Tools",
77
"description": "World Locking Tools for Unity (WLT) + Azure Spatial Anchors (ASA)\n\nThis optional add-on to WLT leverages ASA to persist coordinate spaces across sessions and share them across devices.\nCross platform support includes HoloLens, Android, and iOS.",
@@ -35,7 +35,7 @@
3535
},
3636
"dependencies": {
3737
"com.microsoft.azure.spatial-anchors-sdk.core": "2.9.0",
38-
"com.microsoft.mixedreality.worldlockingtools": "1.5.2"
38+
"com.microsoft.mixedreality.worldlockingtools": "1.5.3"
3939
},
4040
"files": [
4141
"WorldLocking.ASA",

0 commit comments

Comments
 (0)