Add HotFix, didn't stick the first time
This commit is contained in:
Родитель
144131dc76
Коммит
f94b03fa5f
|
@ -171,7 +171,7 @@ namespace Microsoft.MixedReality.SceneUnderstanding.Samples.Unity
|
||||||
|
|
||||||
private async void Start()
|
private async void Start()
|
||||||
{
|
{
|
||||||
SceneRoot = SceneRoot == null ? new GameObject("Root") : SceneRoot;
|
SceneRoot = SceneRoot == null ? new GameObject("Scene Root") : SceneRoot;
|
||||||
|
|
||||||
// Considering that device is currently not supported in the editor means that
|
// Considering that device is currently not supported in the editor means that
|
||||||
// if the application is running in the editor it is for sure running on PC and
|
// if the application is running in the editor it is for sure running on PC and
|
||||||
|
@ -192,14 +192,14 @@ namespace Microsoft.MixedReality.SceneUnderstanding.Samples.Unity
|
||||||
|
|
||||||
if (!SceneUnderstanding.SceneObserver.IsSupported())
|
if (!SceneUnderstanding.SceneObserver.IsSupported())
|
||||||
{
|
{
|
||||||
Debug.LogError("SceneUnderstandingDataProvider.Start: Scene Understanding not supported.");
|
Debug.LogError("SceneUnderstandingManager.Start: Scene Understanding not supported.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneObserverAccessStatus access = await SceneUnderstanding.SceneObserver.RequestAccessAsync();
|
SceneObserverAccessStatus access = await SceneUnderstanding.SceneObserver.RequestAccessAsync();
|
||||||
if (access != SceneObserverAccessStatus.Allowed)
|
if (access != SceneObserverAccessStatus.Allowed)
|
||||||
{
|
{
|
||||||
Debug.LogError("SceneUnderstandingDataProvider.Start: Access to Scene Understanding has been denied.\n" +
|
Debug.LogError("SceneUnderstandingManager.Start: Access to Scene Understanding has been denied.\n" +
|
||||||
"Reason: " + access);
|
"Reason: " + access);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ namespace Microsoft.MixedReality.SceneUnderstanding.Samples.Unity
|
||||||
/// <param name="lod">If world mesh is enabled, lod controls the resolution of the mesh returned.</param>
|
/// <param name="lod">If world mesh is enabled, lod controls the resolution of the mesh returned.</param>
|
||||||
private void RetrieveData(float boundingSphereRadiusInMeters, bool enableQuads, bool enableMeshes, bool enableInference, bool enableWorldMesh, SceneUnderstanding.SceneMeshLevelOfDetail lod)
|
private void RetrieveData(float boundingSphereRadiusInMeters, bool enableQuads, bool enableMeshes, bool enableInference, bool enableWorldMesh, SceneUnderstanding.SceneMeshLevelOfDetail lod)
|
||||||
{
|
{
|
||||||
Debug.Log("SceneUnderstandingDataProvider.RetrieveData: Started.");
|
Debug.Log("SceneUnderstandingManager.RetrieveData: Started.");
|
||||||
|
|
||||||
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
|
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
|
||||||
stopwatch.Start();
|
stopwatch.Start();
|
||||||
|
@ -473,21 +473,21 @@ namespace Microsoft.MixedReality.SceneUnderstanding.Samples.Unity
|
||||||
|
|
||||||
if (suScene != null)
|
if (suScene != null)
|
||||||
{
|
{
|
||||||
// If there was previously a scene displayed in the game world, destroy it
|
|
||||||
// to avoid overlap with the new scene about to be displayed
|
|
||||||
DestroyAllGameObjectsUnderParent(SceneRoot.transform);
|
|
||||||
|
|
||||||
// Allow from one frame to yield the coroutine back to the main thread
|
|
||||||
yield return null;
|
|
||||||
|
|
||||||
// Retrieve a transformation matrix that will allow us orient the Scene Understanding Objects into
|
// Retrieve a transformation matrix that will allow us orient the Scene Understanding Objects into
|
||||||
// their correct corresponding position in the unity world
|
// their correct corresponding position in the unity world
|
||||||
System.Numerics.Matrix4x4 sceneToUnityTransformAsMatrix4x4 = GetSceneToUnityTransformAsMatrix4x4(suScene);
|
System.Numerics.Matrix4x4? sceneToUnityTransformAsMatrix4x4 = GetSceneToUnityTransformAsMatrix4x4(suScene);
|
||||||
|
|
||||||
if (sceneToUnityTransformAsMatrix4x4 != null)
|
if (sceneToUnityTransformAsMatrix4x4 != null)
|
||||||
{
|
{
|
||||||
|
// If there was previously a scene displayed in the game world, destroy it
|
||||||
|
// to avoid overlap with the new scene about to be displayed
|
||||||
|
DestroyAllGameObjectsUnderParent(SceneRoot.transform);
|
||||||
|
|
||||||
|
// Allow from one frame to yield the coroutine back to the main thread
|
||||||
|
yield return null;
|
||||||
|
|
||||||
// Using the transformation matrix generated above, port its values into the tranform of the scene root (Numerics.matrix -> GameObject.Transform)
|
// Using the transformation matrix generated above, port its values into the tranform of the scene root (Numerics.matrix -> GameObject.Transform)
|
||||||
SetUnityTransformFromMatrix4x4(SceneRoot.transform, sceneToUnityTransformAsMatrix4x4, RunOnDevice);
|
SetUnityTransformFromMatrix4x4(SceneRoot.transform, sceneToUnityTransformAsMatrix4x4.Value, RunOnDevice);
|
||||||
|
|
||||||
if (!RunOnDevice)
|
if (!RunOnDevice)
|
||||||
{
|
{
|
||||||
|
@ -1064,7 +1064,7 @@ namespace Microsoft.MixedReality.SceneUnderstanding.Samples.Unity
|
||||||
/// from the Scene Understanding Coordinate System to the Unity one
|
/// from the Scene Understanding Coordinate System to the Unity one
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scene"> Scene from which to get the Scene Understanding Coordinate System </param>
|
/// <param name="scene"> Scene from which to get the Scene Understanding Coordinate System </param>
|
||||||
private System.Numerics.Matrix4x4 GetSceneToUnityTransformAsMatrix4x4(SceneUnderstanding.Scene scene)
|
private System.Numerics.Matrix4x4? GetSceneToUnityTransformAsMatrix4x4(SceneUnderstanding.Scene scene)
|
||||||
{
|
{
|
||||||
System.Numerics.Matrix4x4? sceneToUnityTransform = System.Numerics.Matrix4x4.Identity;
|
System.Numerics.Matrix4x4? sceneToUnityTransform = System.Numerics.Matrix4x4.Identity;
|
||||||
|
|
||||||
|
@ -1086,7 +1086,7 @@ namespace Microsoft.MixedReality.SceneUnderstanding.Samples.Unity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sceneToUnityTransform.Value;
|
return sceneToUnityTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1245,11 +1245,11 @@ namespace Microsoft.MixedReality.SceneUnderstanding.Samples.Unity
|
||||||
|
|
||||||
if (suScene != null)
|
if (suScene != null)
|
||||||
{
|
{
|
||||||
System.Numerics.Matrix4x4 sceneToUnityTransformAsMatrix4x4 = GetSceneToUnityTransformAsMatrix4x4(suScene);
|
System.Numerics.Matrix4x4? sceneToUnityTransformAsMatrix4x4 = GetSceneToUnityTransformAsMatrix4x4(suScene);
|
||||||
|
|
||||||
if (sceneToUnityTransformAsMatrix4x4 != null)
|
if (sceneToUnityTransformAsMatrix4x4 != null)
|
||||||
{
|
{
|
||||||
SetUnityTransformFromMatrix4x4(SceneRoot.transform, sceneToUnityTransformAsMatrix4x4, RunOnDevice);
|
SetUnityTransformFromMatrix4x4(SceneRoot.transform, sceneToUnityTransformAsMatrix4x4.Value, RunOnDevice);
|
||||||
|
|
||||||
if (!RunOnDevice)
|
if (!RunOnDevice)
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче