Mixedrealitytoolkit-unity: Hologram Navigation Gesture gaze issue

Created on 26 Jul 2017  路  7Comments  路  Source: microsoft/MixedRealityToolkit-Unity

Using the InputManager prefab from the HoloToolkit and this code:

    [Tooltip("Rotation max speed controls amount of rotation.")]
    public float RotationSensitivity = 2.0f;

    private float rotationFactor, rotationFactor2;

    public void OnNavigationStarted(NavigationEventData eventData)
    {
        Debug.Log("Navigation is started");
    }
    public void OnNavigationUpdated(NavigationEventData eventData)
    {
        rotationFactor = eventData.CumulativeDelta.x * RotationSensitivity;

        rotationFactor2 = eventData.CumulativeDelta.y * RotationSensitivity;

        if (System.Math.Abs(eventData.CumulativeDelta.x) > System.Math.Abs(eventData.CumulativeDelta.y))
        {
            transform.Rotate(new Vector3(0, -1 * rotationFactor, 0));
        }
        else
        {
            transform.Rotate(new Vector3(-1 * rotationFactor2, 0, 0));

            //if this control structure doesnt work, try setting the other value to zero instead
        }

        Debug.Log("event X: " + eventData.CumulativeDelta.x);
        Debug.Log("event Y: " + eventData.CumulativeDelta.y);

    }
    public void OnNavigationCompleted(NavigationEventData eventData)
    {
        Debug.Log("Navigation is completed");
    }
    public void OnNavigationCanceled(NavigationEventData eventData)
    {
        Debug.Log("Navigation is canceled");
    }

The user can tap and hold and move their hand left or right (x-plane) to rotate along the Y axis and up and down (y-plane) to rotate the object on the X axis.

However there appears to be a bug. If the users gaze comes off the object, the rotation stops immediately until the users gaze returns to the object. Is this the intended functionality? Is there a way to preserve the current object being changed via the navigation gesture and allow it to continue being manipulated until the users hand leaves the FOV or releases the tap and hold?

Question

Most helpful comment

Ok. Clear the stack on Navigation started, InputManager.Instance.ClearModalInputStack();, then push it onto the stack, InputManager.Instance.PushModalInputHandler(gameObject); and on navigation completed or canceled pop it, InputManager.Instance.PopModalInputHandler();

All 7 comments

You need to add your object to the modal stack and pop it off when you're done with it.

@StephenHodgson Would you care to elaborate? I've not implemented a stack anywhere. The other post isn't quite clear on adding to the global listeners and removing

The stack is implemented for you in the InputManager. Take a look at HandsDraggable for similar implementation.
Here
Here

Ok. Clear the stack on Navigation started, InputManager.Instance.ClearModalInputStack();, then push it onto the stack, InputManager.Instance.PushModalInputHandler(gameObject); and on navigation completed or canceled pop it, InputManager.Instance.PopModalInputHandler();

Would this be done in a pre-existing script already attached to the InputManager prefab, such as GestureInput, or on my own implementation script?

In your own implementation.

Was this page helpful?
0 / 5 - 0 ratings