- Home /
NGUI with Leap Motion, or NGUI without mouse
I'm trying to call events on the NGUI Button Script, such as OnPress, OnHover, etc., using the Leap Motion Controller.
These messages are called just fine with the mouse but how would I call these functions if the user is not using a mouse and is using an alternative input device?
Thank you for your suggestions!
I'll leave this as a comment as I am a newbie NGUI user and can't consider this as a complete answer. Check out UICamera class as I think you can follow the events around there. Hopefully you can easily add a new controller to the system, to simulate mouse clicks.
I've never used the Leap Controller, but can you already get the 'touch' and 'drag' equivalent events?
Once you have the events you'd want to and add a ProcessLeap (or similar) method which uses that data and call it according to some conditions similar to how it's already done in NGUI's update loop where ProcessTouches, Process$$anonymous$$ouse and ProcessOthers are called.
Statement, thank you! You led me to the code I needed to modify.
Hi Can you please help me doing the same, I am a beginner in Unity 3D and I am using the same libraries. at the moment menus are working fine with the mouse. but I need to do it trough unity. I managed to put the hands into my scene, however, I don't know how to use them as inputs. i really need your help please. Thanks
Answer by seandres · Jan 15, 2014 at 04:01 PM
Try with the package Leap Motion Interactions (http://u3d.as/content/pixelplacement/leap-motion-interactions/5dk) It could be useful for you.
Thank you for the suggestion, but that package did not help.
Answer by pajamajama · Feb 07, 2014 at 09:16 PM
As pointed out by Statement, I needed to modify the UICamera script.
In a nutshell, I did a search for any code that was using "Input.MousePosition" and replaced it with Camera.WorldToScreenSpace().
Your answer
Follow this Question
Related Questions
How to get GameObject that is clicked by a mouse? 2 Answers
Getting the text from UIInput 1 Answer
Projection to mouse position in isometric game 1 Answer
Input.inputString not detecting mouse action? 1 Answer
Unity3D mouse events not working on Amazon Web Services EC2 instance in Play mode 0 Answers