Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code snippet causing errors when implemented #409

Open
WLSmith9386 opened this issue Aug 19, 2021 · 0 comments
Open

Code snippet causing errors when implemented #409

WLSmith9386 opened this issue Aug 19, 2021 · 0 comments
Assignees
Labels
code review Use if user shares code to help resolve their issue help wanted Extra attention is needed mixed-reality/prod mr-dev/tech Pri2

Comments

@WLSmith9386
Copy link

While using namespaces Microsoft.MixedReality.SceneUnderstanding and/or Microsoft.MixedReality I am getting an error with the code snippet

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;
    }

Error is as follows.

error CS0246: The type or namespace name 'SceneUnderstanding' could not be found (are you missing a using directive or an assembly reference?)


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@typride typride added the code review Use if user shares code to help resolve their issue label May 18, 2022
@typride typride added this to the Technical problems milestone May 18, 2022
@typride typride added the help wanted Extra attention is needed label May 18, 2022
@typride typride assigned typride and vtieto and unassigned typride Nov 16, 2022
@typride typride added Pri2 and removed Pri1 labels Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code review Use if user shares code to help resolve their issue help wanted Extra attention is needed mixed-reality/prod mr-dev/tech Pri2
Projects
None yet
Development

No branches or pull requests

4 participants