Search code examples
c#visual-studiounity-game-enginevirtual-realitymrtk

What namespace includes the type HolograhicFrameData?


I'm using this Microsoft Documentation to work with Spatial meshes. https://learn.microsoft.com/en-us/windows/mixed-reality/develop/platform-capabilities-and-apis/scene-understanding-sdk

Under the "Dealing with Transforms" section, they have this example code :

private System.Numerics.Matrix4x4? GetSceneToUnityTransformAsMatrix4x4(SceneUnderstanding.Scene scene)


  System.Numerics.Matrix4x4? sceneToUnityTransform = System.Numerics.Matrix4x4.Identity;

  Windows.Perception.Spatial.SpatialCoordinateSystem sceneCoordinateSystem = Microsoft.Windows.Perception.Spatial.Preview.SpatialGraphInteropPreview.CreateCoordinateSystemForNode(scene.OriginSpatialGraphNodeId);
  HolograhicFrameData holoFrameData =  Marshal.PtrToStructure<HolograhicFrameData>(UnityEngine.XR.XRDevice.GetNativePtr());
  Windows.Perception.Spatial.SpatialCoordinateSystem unityCoordinateSystem = Microsoft.Windows.Perception.Spatial.SpatialCoordinateSystem.FromNativePtr(holoFrameData.ISpatialCoordinateSystemPtr);

  sceneToUnityTransform = sceneCoordinateSystem.TryGetTransformTo(unityCoordinateSystem);

  if(sceneToUnityTransform != null)
  {
      sceneToUnityTransform = ConvertRightHandedMatrix4x4ToLeftHanded(sceneToUnityTransform.Value);
  }
  else
  {
      return null;
  }

return sceneToUnityTransform;

I am unable to use the HolograhicFrameData datatype, as it cannot be found. I have searched through all of the documentation, but it explicitly says at the top : "All of the types described below reside in the Microsoft.MixedReality.SceneUnderstanding namespace". Searching for this type on Google only leads to the documentation I previously mentioned. I also tried using Microsoft.Windows.Graphics.Holographic; But to no avail.

What namespace includes the type HolograhicFrameData?


Solution

  • There is a typo in the name and is probably a custom class. A little mistake, the closest class I found was HolographicFrame.

    The variable holoFrameData instance of HolographicFrameData class uses ISpatialCoordinateSystemPtr property, which is inherited by IWindowsMixedRealityUtilitiesProvider interface

    Found another reference, but not the same HolographicFrameNativeData

    It's used here as well Mixed Reality (Unity)