MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Cursor disappears when a navigation/manipulation gesture is cancelled

Open annazus opened this issue 9 years ago • 5 comments

I am using the new HoloToolkit Input Module. I created an object to respond to navigation gestures - added a script to implement the INavigationHandler interface.

Things work well excepting for the fact that the cursor disappears when a navigation is cancelled( hand disappears from view). I am using the cursor prefabs (BasicCursor or CursorWithFeedback) provided by HoloToolkit.

Am I missing something in my implementation?

I get the same effect with the manipulation interfafce.

annazus avatar Jan 03 '17 23:01 annazus

After some digging, CheckCursorState function in Cursor.cs must also check that the # of visible hands is > than zero before returning CursorStateEnum.Select

  public virtual CursorStateEnum CheckCursorState()
        {
            if (cursorState != CursorStateEnum.Contextual)
            {
                if (IsInputSourceDown )                 {
                    return CursorStateEnum.Select;
                }

must be changed to

  public virtual CursorStateEnum CheckCursorState()
        {
            if (cursorState != CursorStateEnum.Contextual)
            {
                if (IsInputSourceDown  && visibleHandsCount > 0)                 {
                    return CursorStateEnum.Select;
                }

annazus avatar Jan 03 '17 23:01 annazus

Hi @islacoder, great find! Would you like to submit a PR that addresses these changes?

StephenHodgson avatar Jan 04 '17 00:01 StephenHodgson

Thanks . I will do that.

annazus avatar Jan 04 '17 00:01 annazus

With just that fix it, the cursor disappears when the hand becomes visible because IsInputSourceDown is still set to true due toOnInputUp never being called. Something like another check with an if statement resolves this:

public virtual CursorStateEnum CheckCursorState()
{
    if (cursorState != CursorStateEnum.Contextual)
    {
        if (IsInputSourceDown && visibleHandsCount > 0)
        {
            return CursorStateEnum.Select;
         }
         else if (IsInputSourceDown && visibleHandsCount == 0)
         {
             IsInputSourceDown = false;
         }

bhtruong93 avatar Jan 23 '17 22:01 bhtruong93

I don't think a PR ever got submitted for this.

StephenHodgson avatar Jan 24 '17 02:01 StephenHodgson