Author Topic: Hello, I need some help. About NGUI work with Kinect Input.  (Read 1795 times)

nugao

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Hello, I need some help. About NGUI work with Kinect Input.
« on: December 04, 2014, 09:16:31 AM »
Hello.

I try NGUI work with Kinect Input.

First, I use mouse to simulate a human hand cursor in Kinect, it's work. Just do it as a mouse with 'onCustomInput'.

But the next, when I use two cursors and more cursors, I just simulate cursors as mouse can not work. Because mouse is only ONE.

I have tried to change UICamera code to simulate two kinect cursors, I get two problems:

1)When two cursors move over a UIControl both, The OnHover(true/false) events had triggered with two cursors.
   The UIControl's 'Hover' state has canceled while a cursor move out it, but the other cursor still over that UIControl.
   How to hold that UIControl to 'Hover' state, when other cursor still hover on it?

2)When cursor 'Press' on a UIControl like a UIButton, the 'OnPress(true/false)' event repeat to trigger. I found NGUI 'ProcessMouse' do click is 'GetMouseButtonDown' 'GetMouseButtonUp', its get one time when mouse has clicked. My code always trigger OnPress, because it do click in every frame.


In my demo code, I have two simulate cursor, it use keyboard to control. The Key "W,S,A,D" and "Up,Down,Left,Right" control to cursors move. The Key "1,2" do click.
My demo code has send to 'support at tasharen.com'.

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Hello, I need some help. About NGUI work with Kinect Input.
« Reply #1 on: December 05, 2014, 12:47:36 AM »
1. This is where you run into the issue where NGUI was never meant to support more than one mouse cursor at the same time. What you need to do is to use touch, not mouse. Custom input is after all, custom -- you can do what you want, as long as you call ProcessTouch(). In regards to hover states though... this will always be an issue if you use the stock UIButton class. You need to create your own that will count the number of hover states.

2. Same as #1. Don't use ProcessMouse(). You are not processing a mouse device. Do your own raycast inside the onCustomInput function, set up your own MouseOrTouch and call ProcessTouch(). Look at how it's done in ProcessFakeTouches().

nugao

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Hello, I need some help. About NGUI work with Kinect Input.
« Reply #2 on: December 05, 2014, 01:36:20 AM »
Thank you very much for your reply.

I'll try again.