1
NGUI 3 Support / Novint Falcon Controller; Raycast from sprite position
« on: October 28, 2013, 05:11:39 PM »
Hello,
I was given a Novint Falcon controller to play with in a unity project. Sadly the controller doesnt actually replace the regular mouse so i'm having to roll my own controller.
A sprite is functioning as a cursor that i move around using a delta given by the Falcon. I have also written a button handler but i can't seem to get the raycasting sorted.
Is there an easy way to get a raycast going in NGUI using a sprites position instead of the mouse?
I was given a Novint Falcon controller to play with in a unity project. Sadly the controller doesnt actually replace the regular mouse so i'm having to roll my own controller.
A sprite is functioning as a cursor that i move around using a delta given by the Falcon. I have also written a button handler but i can't seem to get the raycasting sorted.
Is there an easy way to get a raycast going in NGUI using a sprites position instead of the mouse?
- if( Haptics.isButton0Down() && !middleButtonPressed )
- {
- middleButtonPressed = true;
- //Raycast
- if( UICamera.Raycast( UICamera.mainCamera.WorldToScreenPoint( mTrans.localPosition ) , out hit ) )
- {
- Debug.Log( hit.collider.name );
- //SendMessage( "OnClick");
- //SendMessage( "OnPress", true );
- }
- }
- else if( !Haptics.isButton0Down() && middleButtonPressed )
- {
- middleButtonPressed = false;
- //SendMessage( "OnPress", false );
- }