Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

How to know position of my application being opened?

Hi,

Is there a way to get the coordinates of where my current gaze is?
Let me explain in detail..
I have my own cursor for the application and it appears along with my holograms...but i am trying to show my cursor before the holograms are even loaded...that is.. I wanna show my cursor as soon as my application gets loaded...So, if I can get the current position of my gaze...Probably I may be able to do that..Do we have any way through which I can get my current gaze position or the position where my application is getting opened in world space.

Answers

  • Options

    Hi Afreen_Firdous26,

    If you are using Unity then I recommend going through the Microsoft Holographic Academy - specifically Holograms 210.

    If you are using DirectX then this page helped me out a lot. Sorry I don't have the code with me at the moment but basically you use a SpatialLocator to create a SpatialStationaryFrameOfReference. Then use the CoordinateSystem from the SpatialStationaryFrameOfReference to get the SpatialPointerPose and then you can get the direction the user is looking at.

    If you want the cursor to hit walls you will need spatial mapping in your application.

    If you are developing in C# here is what some of the code looks like from the top of my head/from here:

    SpatialLocator spatialLocator = SpatialLocator.GetDefault();
    
    SpatialStationaryFrameOfReference referenceFrame = spatialLocator.CreateStationaryFrameOfReferenceAtCurrentLocation();
    
    SpatialInteractionSourceState pointerState;//Can't remember where this comes from
    
    SpatialPointerPose pointerPose = pointerState.TryGetPointerPose(referenceFrame.CoordinateSystem);
    
    Vector3 headPosition = pointerPose.Head.Position;
    Vector3 headDirection = pointerPose.Head.ForwardDirection;
    
    //Add distance to the gaze direction
    float distanceFromUser = 2.0f; //2 meters
    Vector3 gazeAtTwoMeters = headPosition + (distanceFromUser * headDirection);
    
    

    If you are still having trouble, on Monday I will have access to my code and can share it then.

  • Options

    Hi ShayneKiekebosch,

    I am working in unity.Yeah I have seen Holograms 210.But my question was like how to get position of where my application is getting opened..Do we have any method in would work in unity..what you have shared is I think for the DirectX..Thanks for the reply:)

Sign In or Register to comment.