How to add click action to cursor in hololens

浪尽此生 提交于 2019-12-04 15:03:05

To add the ability to "click" you can do this with the Input Manager that is built into the HoloLens Toolkit. See here:

https://github.com/Microsoft/HoloToolkit-Unity/tree/master/Assets/HoloToolkit/Input

Specifically you should add the InputManager prefab to your scene, then add to a script that is attached to an object an implementation of IInputClickHandler. So something like this:

public class DoSomethingOnClick : MonoBehaviour, IInputClickHandler
{
     void IInputClickHandler.OnInputClicked(InputEventData eventData)
    {
         // A Click happened here, do something about it
    }
}

Make sure you dont forget to have an event system in your scene.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!