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

Is there a way to get the User's own hand position when they put it into view of the HoloLens?

It's obvious that the HoloLens can detect when the user's finger is in the ready position. Is there a way to get the position of the hand when the user enters this state?

AR Developer

Best Answer

  • Options
    dbarrettdbarrett ✭✭✭
    edited October 2017 Answer ✓

    I found the answer, just attach this script to an object in the scene.

    using UnityEngine.VR.WSA.Input;

    void Awake () {
    
        InteractionManager.SourcePressed += GetPosition;
    
    }
    
    private void GetPosition(InteractionSourceState state)
    {
        Vector3 pos;
        if (state.properties.location.TryGetPosition(out pos))
        {
            Debug.Log(pos);
        }
    }
    

    AR Developer

Answers

  • Options
    dbarrettdbarrett ✭✭✭
    edited October 2017 Answer ✓

    I found the answer, just attach this script to an object in the scene.

    using UnityEngine.VR.WSA.Input;

    void Awake () {
    
        InteractionManager.SourcePressed += GetPosition;
    
    }
    
    private void GetPosition(InteractionSourceState state)
    {
        Vector3 pos;
        if (state.properties.location.TryGetPosition(out pos))
        {
            Debug.Log(pos);
        }
    }
    

    AR Developer

  • Options
    james_ashleyjames_ashley ✭✭✭✭

    @dbarrett,

    You can capture events from the Unity InteractionManager:

    UnityEngine.VR.WSA.Input.InteractionManager.SourceDetected

    or

    UnityEngine.XR.WSA.Input.InteractionManager.SourceDetected

    (depending on whether you are up to 2017.2 or not, yet)

    Then grab the hand position from the event argument passed to your handler:

            private void InteractionManager_SourceDetected(InteractionSourceState state)
            {
                Vector3 hand_position;
                state.properties.location.TryGetPosition(out hand_position);
    

    ...

    James

    James Ashley
    VS 2017 v5.3.3, Unity 2017.3.0f3, MRTK 2017.1.2, W10 17063
    Microsoft MVP, Freelance HoloLens/MR Developer
    www.imaginativeuniversal.com

  • Options
    james_ashleyjames_ashley ✭✭✭✭

    Oh man. Jinx.

    James Ashley
    VS 2017 v5.3.3, Unity 2017.3.0f3, MRTK 2017.1.2, W10 17063
    Microsoft MVP, Freelance HoloLens/MR Developer
    www.imaginativeuniversal.com

Sign In or Register to comment.