Software Archive
Read-only legacy content
17061 Discussions

Touchless controller , cursor not moving

HexLord
Beginner
407 Views

Hi, 

I am trying to write a test touchless program to understand its working, but the cursor doesnt seem to move .\

It is able to detect which hand is in front of the camera but doesnt move the cursor.

Here's he code.

 // Create a SenseManager instance.
            PXCMSenseManager sm = PXCMSenseManager.CreateInstance();

            // Enable the touchless controller feature.
            sm.EnableTouchlessController();

            // Initialize the pipeline
            sm.Init();

            // Get the module instance
            PXCMTouchlessController tc = sm.QueryTouchlessController();

            // register for the ux events
            tc.SubscribeEvent(OnFiredUXEvent);
            tc.SubscribeEvent(UXEvent_CursorVisible);
            tc.SubscribeEvent(UXEvent_CursorMove);

            // Streaming data
            while (sm.AcquireFrame(true) >= pxcmStatus.PXCM_STATUS_NO_ERROR)
            {
                sm.ReleaseFrame();
            }

            // Clean up
            sm.Dispose();
        }

        private void UXEvent_CursorMove(PXCMTouchlessController.UXEventData data)
        {
       
        }

        private void UXEvent_CursorVisible(PXCMTouchlessController.UXEventData data)
        {
            
            textBox1.AppendText(data.bodySide.ToString());
            
        }

        void OnFiredUXEvent(PXCMTouchlessController.UXEventData uxEventData) {
       
}

 Pls Help

 

Thanks

Shaleen

0 Kudos
1 Reply
Piotr_P_
Beginner
407 Views

Try to use only OnFiredUXEvent handler. Here is example how I use it:

 

        void OnFiredUXEvent(PXCMTouchlessController.UXEventData uxEventData)
        {
                switch (uxEventData.type)
                {
                    case PXCMTouchlessController.UXEventData.UXEventType.UXEvent_CursorVisible:
                        {
                            // do something
                        }
                        break;
                    case PXCMTouchlessController.UXEventData.UXEventType.UXEvent_CursorNotVisible:
                        {
                            // do something
                        }
                        break;
                    case PXCMTouchlessController.UXEventData.UXEventType.UXEvent_CursorMove:
                        {
                        // do something

                        }
                        break;
                }

            
        }

 

0 Kudos
Reply