Search Unity

XR Interaction toolkit : selection through scripts, hovering condition, Interactables behaviour

Discussion in 'XR Interaction Toolkit and Input' started by Alemaout, Apr 16, 2020.

  1. Alemaout

    Alemaout

    Joined:
    Apr 16, 2020
    Posts:
    2
    Hello,

    I have been trying out the XR Interaction toolkit, currently in preview (version 0.9.3, with Unity 2019.3.7f1) and I'm encountering difficulties in adapting in to my project's requirement. I have three main questions :

    - Firstly, in order to interact with AR objects in the scene, the documentation specifies that you need to add at least an "AR Selection Interactable" component to whatever object or prefab you're trying to interact with. In my projet, I'm trying to scale an object with a pinch gesture so I also added an "AR Scale Interactable" component to it. Now when running the app, you have to first aim at the object with the camera to trigger an OnHovering event, then tap on the object to trigger an OnSelect event, and finally you can use the pinch gesture to scale the object at will. Instead of tapping on the object to select it, I would like to be able to place an object in a "selected" state from a script. I understand perfectly how necessary it is to hover and select an object prior to interact with it when the scene contains several intractable objects, but this does not apply to my situation. Indeed, in my case, there is only one object that I want to allow the user to interact with and therefore I don't want the user to have to click on it before being able to scale it with a pinch gesture. Instead, I would like the user to be able to scale it whenever the object appears on screen, without having to first select it. Since it will be the only selectable item, there is no confusion possible and I would like to remove the now unnecessary "click to select" user action.
    I have tried to get into the scripts of the toolkit but the "selected" parameter is internal and even by created derived classes, I cannot find a way to go around this problem, is there any workaround?

    - Secondly, and this is close to the first problem, I would, like to have more flexibility regarding the OnHover event trigger. I've noticed that currently this events triggers only when the center of the object is visible on screen. I would like to change that to "any part of the object" is visible. Same than above, I cannot get modify the "hoverTargets" list from a script, even using derived classes, any suggestion?

    - Lastly, I would like to customise the Interactables behaviour, and more specifically the "AR Translation Interactable" : which gestures does it respond to and how. By default, it seems that this intractable only responds to a one finger drag gesture and when the "Object Gesture Translation Mode" parameter is set to "Horizontal", a horizontal drag gesture causes the object to translate horizontally to the side and a vertical drag gesture causes the object to translate horizontally closer or further to the camera. To do that, the AR Session must have detected a flat surface beforehand to be able to define a "horizontal motion" but the object doesn't seem to need to be attached to any actual flat surface and will just be translated parallel to it. However, when set to "Vertical", the object will only move if attached to a detected vertical flat surface, an if it is just floating in the air, I have noticed it cannot be translated with any kind of gesture. I would like to be able the use the "horizontal" mode with a one finger drag gesture and the "vertical" mode with a two finger drag gesture, without the item needing to be attached to a vertical plan. Regarding the fact that the vertical mode doesn't work properly if the object is floating, is it a bug or is it intended? And regarding the use of two finger drag gestures to translate an object it doesn't seem to be possible currently because all the functions implemented in the ARTranslationInteractable.cs script, require a DragGesture type parameter as an input. Is there any plan in the future versions of the toolkit to chose between a DragGesture and a TwoFingerDragGesture?

    Thank you for you help.
     
    nosarious, nems808 and goout88 like this.